add uninstaller, make sure installer downloads and sets it up for us too

This commit is contained in:
VetheonGames 2024-01-08 18:16:52 -07:00
parent 124eed083a
commit 885a3fbab0
2 changed files with 35 additions and 2 deletions

View File

@ -105,6 +105,11 @@ go build -o ~/.allpac/bin/allpac || { echo "Failed to build binary. Exiting."; e
echo "Downloading updater script..."
updater_url="https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Installers/raw/branch/main/allpac/update.sh"
wget -O ~/.allpac/bin/allpac-updater.sh "$updater_url" || { echo "Failed to download updater script. Exiting."; exit 1; }
sleep 2
echo "Downloading uninstaller script..."
uninstaller_url="https://git.pixelridgesoftworks.com/PixelRidge-Softworks/Installers/raw/branch/main/allpac/uninstall.sh"
wget -O ~/.allpac/bin/allpac-uninstaller.sh "$uninstaller_url" || { echo "Failed to download uninstaller script. Exiting."; exit 1; }
echo "Setting updater script permissions..."
chmod u+rwx ~/.allpac/bin/allpac-updater.sh
@ -122,9 +127,16 @@ fi
if ! grep -q "alias allpac-update-system=" "$shell_rc"; then
echo "alias allpac-update-system='$HOME/.allpac/bin/allpac-updater.sh'" >> "$shell_rc"
echo "Alias added to $shell_rc"
echo "Update Alias added to $shell_rc"
else
echo "Alias already exists in $shell_rc"
echo "Update Alias already exists in $shell_rc"
fi
if ! grep -q "alias uninstall-allpac=" "$shell_rc"; then
echo "alias uninstall-allpac=$HOME/.allpac/bin/allpac-uninstaller.sh''" >> "$shell_rc"
echo "Uninstall Alias added to $shell_rc"
else
echo "Uninstall Alias already exists in $shell_rc"
fi
echo "Adding AllPac to the system path for all users..."

21
allpac/uninstall.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# Function to remove a file or directory if it exists
remove_if_exists() {
if [ -e "$1" ]; then
rm -rf "$1"
echo "Removed $1"
else
echo "$1 does not exist, no need to remove"
fi
}
echo "Uninstalling AllPac..."
# Remove ~/.allpac directory
remove_if_exists "$HOME/.allpac"
# Remove /etc/profile.d/allpac.sh
sudo remove_if_exists "/etc/profile.d/allpac.sh"
echo "AllPac has been uninstalled."