Make installer download the updater too

This commit is contained in:
VetheonGames 2024-01-07 18:10:01 -07:00
parent 0dfad72a05
commit 1286efdf01

View File

@ -1,20 +1,16 @@
#!/bin/bash #!/bin/bash
# Step 1: Create directories
mkdir -p ~/.allpac/cache ~/.allpac/logs ~/.allpac/bin mkdir -p ~/.allpac/cache ~/.allpac/logs ~/.allpac/bin
# Step 2: Check Go version
go_version=$(go version 2>/dev/null) go_version=$(go version 2>/dev/null)
required_version="go1.21.5" required_version="go1.21.5"
if [[ "$go_version" != *"$required_version"* ]]; then if [[ "$go_version" != *"$required_version"* ]]; then
echo "Required Go version is not installed." echo "Required Go version is not installed."
# Step 3: Ask for permission to install Go
read -p "Do you want to install Go? [Y/n] " -n 1 -r read -p "Do you want to install Go? [Y/n] " -n 1 -r
echo echo
if [[ $REPLY =~ ^[Yy]$ ]]; then if [[ $REPLY =~ ^[Yy]$ ]]; then
# For Arch Linux and Arch-based distributions
sudo pacman -Sy go sudo pacman -Sy go
else else
echo "Go not installed. Exiting." echo "Go not installed. Exiting."
@ -35,7 +31,6 @@ if ! command -v git &>/dev/null; then
fi fi
fi fi
# Clone the Go source code
git clone https://git.pixelridgesoftworks.com/PixelRidge-Softworks/AllPac.git git clone https://git.pixelridgesoftworks.com/PixelRidge-Softworks/AllPac.git
cd AllPac/cmd/ || exit cd AllPac/cmd/ || exit
@ -61,7 +56,14 @@ esac
echo 'export PATH=$PATH:$HOME/.allpac/bin' >> "$shell_rc" echo 'export PATH=$PATH:$HOME/.allpac/bin' >> "$shell_rc"
source "$shell_rc" source "$shell_rc"
# Clean up updater_url="https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Installers/raw/branch/main/allpac/update.sh"
wget -O ~/.allpac/bin/allpac-updater.sh "$updater_url"
chmod u+rwx ~/.allpac/bin/allpac-updater.sh
echo "alias allpac-update-system='~/.allpac/bin/allpac-updater.sh'" >> "$shell_rc"
source "$shell_rc"
cd ../../ cd ../../
rm -rf AllPac rm -rf AllPac