From 976c83ef59c5824792a7a9ebfdfccc257aefaba6 Mon Sep 17 00:00:00 2001 From: victor Date: Sun, 3 Jan 2021 11:50:19 +0330 Subject: [PATCH] uninstaller script added --- scripts/uninstaller.sh | 84 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100755 scripts/uninstaller.sh diff --git a/scripts/uninstaller.sh b/scripts/uninstaller.sh new file mode 100755 index 0000000..3219f3d --- /dev/null +++ b/scripts/uninstaller.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +source "sharedFuncs.sh" + +main() { + + CMD_PATH="/usr/local/bin/illustrator" + ENTRY_PATH="/home/$USER/.local/share/applications/illustratorCC.desktop" + + notify-send "illustrator uninstaller started" -i "inkscape" + + ask_question "you are uninstalling illustrator cc are you sure?" "N" + if [ $result == "no" ];then + echo "Ok good Bye :)" + exit 0 + fi + + #remove illustrator directory + if [ -d "$SCR_PATH" ];then + echo "remove illustrator directory..." + rm -r "$SCR_PATH" || error2 "couldn't remove illustrator directory" + sleep 4 + else + echo "illustrator directory Not Found!" + fi + + + #Unlink command + if [ -L "$CMD_PATH" ];then + echo "remove launcher command..." + sudo unlink "$CMD_PATH" || error2 "couldn't remove launcher command" + else + echo "launcher command Not Found!" + fi + + #delete desktop entry + if [ -f "$ENTRY_PATH" ];then + echo "remove desktop entry...." + echo "$SCR_PATH" + rm "$ENTRY_PATH" || error2 "couldn't remove desktop entry" + else + echo "desktop entry Not Found!" + fi + + #delete cache directoy + if [ -d "$CACHE_PATH" ];then + echo "--------------------------------" + echo "all downloaded components are in cache directory and you can use them for illustrator installation next time without wasting internet traffic" + echo -e "your cache directory is \033[1;36m$CACHE_PATH\e[0m" + echo "--------------------------------" + ask_question "would you delete cache directory?" "N" + if [ "$result" == "yes" ];then + rm -rf "$CACHE_PATH" || error2 "couldn't remove cache directory" + else + echo "nice, you can copy component data and use them later for illustrator installation" + fi + else + echo "cache directory Not Found!" + fi + +} + +#parameters [Message] [default flag [Y/N]] +function ask_question() { + result="" + if [ "$2" == "Y" ];then + read -r -p "$1 [Y/n] " response + if [[ "$response" =~ $(locale noexpr) ]];then + result="no" + else + result="yes" + fi + elif [ "$2" == "N" ];then + read -r -p "$1 [N/y] " response + if [[ "$response" =~ $(locale yesexpr) ]];then + result="yes" + else + result="no" + fi + fi +} + +load_paths +main