From 885a3fbab0c61e4a96fc318c9c809936eb52201d Mon Sep 17 00:00:00 2001 From: VetheonGames Date: Mon, 8 Jan 2024 18:16:52 -0700 Subject: [PATCH] add uninstaller, make sure installer downloads and sets it up for us too --- allpac/install.sh | 16 ++++++++++++++-- allpac/uninstall.sh | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 allpac/uninstall.sh diff --git a/allpac/install.sh b/allpac/install.sh index 8b842b6..6d74b9e 100644 --- a/allpac/install.sh +++ b/allpac/install.sh @@ -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..." diff --git a/allpac/uninstall.sh b/allpac/uninstall.sh new file mode 100644 index 0000000..9fdeeff --- /dev/null +++ b/allpac/uninstall.sh @@ -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."