a3fa99891b
Changed the pacman install command to 'pacman -Syu' to make the Arch Linux Forum shutup Added some echo statements to throw shade at the arch forums and it's terrible users refactor the path export to add in some logic to prevent the path from being ammended every time the user shell starts
126 lines
3.4 KiB
Bash
126 lines
3.4 KiB
Bash
#!/bin/bash
|
|
|
|
mkdir -p ~/.allpac/cache ~/.allpac/logs ~/.allpac/bin
|
|
|
|
echo "We are about to write a new pkg.list"
|
|
echo "Do you want us to proceed?"
|
|
echo "(reply "n" if you already have a pkg.list)"
|
|
read -p "Proceed? [Y/n] " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
echo "Writing new pkg.list..."
|
|
sleep 1
|
|
touch ~/.allpac/pkg.list
|
|
echo "{}" > pkg.list
|
|
else
|
|
echo "Skipping writing new pkg.list..."
|
|
sleep 1
|
|
fi
|
|
|
|
go_version=$(go version 2>/dev/null)
|
|
required_version="go1.21.5"
|
|
|
|
echo "Checking if Go is installed..."
|
|
if [[ "$go_version" != *"$required_version"* ]]; then
|
|
echo "Required Go version is not installed."
|
|
|
|
read -p "Do you want to install Go? (this will also preform a general system update with pacman) [Y/n] " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
echo "Running 'sudo pacman -Syu go' instead of 'pacman -Sy'..."
|
|
echo "Because the Arch Developers won't make Pacman alert you of this, I guess AllPac has to..."
|
|
echo "Running 'pacman -Sy'/'pacman -S' syncs the package database, but doesn't update the actual packages"
|
|
echo "This can cause a lot of problems if something get's updated but something that depends on it doesn't."
|
|
echo "It's called a 'Partial Upgrade' and it can break your system"
|
|
echo "If you wanna install a package and you don't use AllPac, always just run 'pacman -Syu {package}'"
|
|
echo "That's all it took to explain the issue properly Scimmia..."
|
|
echo "Arch Linux Forums users/devs are toxic."
|
|
sleep 3
|
|
sudo pacman -Syu go
|
|
else
|
|
echo "Go not installed. Exiting."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
echo "Compatible Go version is installed!"
|
|
echo "Checking if Git is installed..."
|
|
|
|
if ! command -v git &>/dev/null; then
|
|
echo "Git is not installed."
|
|
|
|
read -p "Do you want to install Git? [Y/n] " -n 1 -r
|
|
echo
|
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
sudo pacman -Syu git
|
|
else
|
|
echo "Git not installed. Exiting."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
echo "Git is installed!"
|
|
|
|
echo "Cloning AllPac Repository from Git..."
|
|
sleep 1
|
|
|
|
git clone https://git.pixelridgesoftworks.com/PixelRidge-Softworks/AllPac.git
|
|
|
|
echo "Descending into cloned repo..."
|
|
sleep 1
|
|
cd AllPac/cmd/ || exit
|
|
|
|
echo "Ensuring we have up to date dependencies..."
|
|
go mod tidy
|
|
sleep 1
|
|
|
|
echo "Building binary..."
|
|
go build -o ~/.allpac/bin/allpac
|
|
sleep 1
|
|
|
|
echo "Binary built!"
|
|
|
|
shell_rc=""
|
|
case $SHELL in
|
|
*/bash)
|
|
shell_rc="$HOME/.bashrc"
|
|
;;
|
|
*/zsh)
|
|
shell_rc="$HOME/.zshrc"
|
|
;;
|
|
*)
|
|
echo "Unsupported shell. Please manually add ~/.allpac/bin to your PATH."
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
echo "Adding AllPac to the system path..."
|
|
sleep 1
|
|
if ! grep -qF 'export PATH=$PATH:$HOME/.allpac/bin' "$shell_rc"; then
|
|
echo 'export PATH=$PATH:$HOME/.allpac/bin' >> "$shell_rc"
|
|
fi
|
|
source "$shell_rc"
|
|
|
|
updater_url="https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Installers/raw/branch/main/allpac/update.sh"
|
|
echo "Downloading updater script..."
|
|
wget -O ~/.allpac/bin/allpac-updater.sh "$updater_url"
|
|
sleep 1
|
|
|
|
echo "Setting updater script permissions..."
|
|
chmod u+rwx ~/.allpac/bin/allpac-updater.sh
|
|
sleep 1
|
|
|
|
echo "Aliasing the updater script..."
|
|
echo "alias allpac-update-system='~/.allpac/bin/allpac-updater.sh'" >> "$shell_rc"
|
|
source "$shell_rc"
|
|
|
|
echo "Cleaning up..."
|
|
cd ../../
|
|
rm -rf AllPac
|
|
|
|
echo "AllPac setup complete."
|