From ae29e8724f85b00106422eca8d591de72c58a890 Mon Sep 17 00:00:00 2001 From: Amr AlSamahy Date: Mon, 16 Sep 2024 14:14:44 +0300 Subject: [PATCH] feat: Uninstaller Script Signed-off-by: Amr AlSamahy --- uninstall.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 uninstall.sh diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..eeaa116 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +bold=$(tput bold) +normal=$(tput sgr0) +files=() + +if [[ "$OSTYPE" == "darwin"* ]]; then + CMAKE_INSTALL_PREFIX='/usr/local' + files+=( + "/Applications/IMSProg.app" + "/Applications/IMSProg Database Update.app" + "/Applications/IMSProg Editor.app") +else + CMAKE_INSTALL_PREFIX='/usr' +fi + +files+=( + "${CMAKE_INSTALL_PREFIX}/bin/IMSProg" + "${CMAKE_INSTALL_PREFIX}/share/pixmaps" + "${CMAKE_INSTALL_PREFIX}/share/imsprog" + "${CMAKE_INSTALL_PREFIX}/share/doc/imsprog" + "${CMAKE_INSTALL_PREFIX}/bin/IMSProg_database_update" + "${CMAKE_INSTALL_PREFIX}/share/applications/IMSProg_database_update.desktop" + "${CMAKE_INSTALL_PREFIX}/share/man/man1/IMSProg.1.gz" + "${CMAKE_INSTALL_PREFIX}/share/man/man1/IMSProg_database_update.1.gz" + "${CMAKE_INSTALL_PREFIX}/share/metainfo/io.github.bigbigmdm.imsprog.metainfo.xml" + "${CMAKE_INSTALL_PREFIX}/share/metainfo/io.github.bigbigmdm.imsprog_database_update.metainfo.xml" + "${CMAKE_INSTALL_PREFIX}/bin/IMSProg_editor" + "${CMAKE_INSTALL_PREFIX}/share/man/man1/IMSProg_editor.1.gz" + "${CMAKE_INSTALL_PREFIX}/share/metainfo/io.github.bigbigmdm.imsprog_editor.metainfo.xml" + "${HOME}/.local/share/imsprog") + +echo "${bold}Warning: This script will permanently delete the following files and directories:${normal}" + +for file in "${files[@]}"; do + echo "${bold}\"$file\"${normal}" +done + +read -rp "Are you sure you want to proceed? (Y/n): " confirm +confirm=${confirm:-y} + +if [[ $confirm != "y" && $confirm != "Y" ]]; then + echo "Operation Canceled." + exit 1 +fi + +for file in "${files[@]}"; do + sudo rm -rf "$file" +done && echo Uninstall Complete