From aa8f16a57175443581d121ab62ef08ea24b6c7c5 Mon Sep 17 00:00:00 2001 From: Pim Nelissen Date: Mon, 26 Aug 2024 10:41:09 +0200 Subject: [PATCH] update uninstall script, renames --- install.sh | 2 +- scripts/{pcs-copy => cb} | 0 .../{pcs-toggle-touchpad => toggle-touchpad} | 0 scripts/{pcs-xgfortran => xg-fortran} | 0 uninstall.sh | 22 +++++++++++++++---- 5 files changed, 19 insertions(+), 5 deletions(-) rename scripts/{pcs-copy => cb} (100%) rename scripts/{pcs-toggle-touchpad => toggle-touchpad} (100%) rename scripts/{pcs-xgfortran => xg-fortran} (100%) diff --git a/install.sh b/install.sh index 80d31ca..58b5024 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/usr/bin/bash PATH_TO_INSTALL=/home/$(whoami)/.local/bin -FILES=($PWD/scripts/pcs*) +FILES=($PWD/scripts/*) NUM_OF_FILES=${#FILES[@]} for f in ${FILES[*]} diff --git a/scripts/pcs-copy b/scripts/cb similarity index 100% rename from scripts/pcs-copy rename to scripts/cb diff --git a/scripts/pcs-toggle-touchpad b/scripts/toggle-touchpad similarity index 100% rename from scripts/pcs-toggle-touchpad rename to scripts/toggle-touchpad diff --git a/scripts/pcs-xgfortran b/scripts/xg-fortran similarity index 100% rename from scripts/pcs-xgfortran rename to scripts/xg-fortran diff --git a/uninstall.sh b/uninstall.sh index d27b3d8..e960f0c 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,8 +1,22 @@ #!/usr/bin/bash -PATH=/home/$(whoami)/.local/bin -TO_DELETE=($PATH/pcs*) -NUM_OF_FILES=${#TO_DELETE[@]} +PATH_TO_REMOVE=/home/$(whoami)/.local/bin +TO_DELETE=$() -/usr/bin/rm -f ${TO_DELETE[@]} +TO_DELETE=() + +for i in "$PWD/scripts"/*; do + TO_DELETE+=("$(basename "$i")") +done + +for filename in "${TO_DELETE[@]}"; do + if [ -e "$PATH_TO_REMOVE/$filename" ]; then + rm "$PATH_TO_REMOVE/$filename" + echo "Removed $PATH_TO_REMOVE/$filename" + else + echo "File $PATH_TO_REMOVE/$filename does not exist" + fi +done + +NUM_OF_FILES=${#TO_DELETE[@]} echo $NUM_OF_FILES scripts removed from $PATH.