photoshopCClinux/scripts/uninstaller.sh

86 lines
2.4 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
source "sharedFuncs.sh"
2021-01-02 13:15:41 +00:00
main() {
2020-02-14 06:21:24 +00:00
CMD_PATH="/usr/local/bin/photoshop"
ENTRY_PATH="/home/$USER/.local/share/applications/photoshop.desktop"
2020-02-14 07:10:39 +00:00
2021-01-09 10:57:04 +00:00
notify-send "Photoshop CC" "photoshop uninstaller started" -i "photoshop"
2020-02-14 06:21:24 +00:00
2020-02-14 05:33:44 +00:00
ask_question "you are uninstalling photoshop cc v19 are you sure?" "N"
2020-02-14 06:21:24 +00:00
if [ $result == "no" ];then
echo "Ok good Bye :)"
exit 0
fi
#remove photoshop directory
if [ -d "$SCR_PATH" ];then
echo "remove photoshop directory..."
rm -r "$SCR_PATH" || error2 "couldn't remove photoshop directory"
2020-02-14 06:21:24 +00:00
sleep 4
else
echo "photoshop directory Not Found!"
fi
2020-02-14 07:49:36 +00:00
2020-02-14 06:21:24 +00:00
#Unlink command
2020-02-14 07:49:36 +00:00
if [ -L "$CMD_PATH" ];then
2020-05-04 09:56:30 +00:00
echo "remove launcher command..."
2020-08-17 08:50:18 +00:00
sudo unlink "$CMD_PATH" || error2 "couldn't remove launcher command"
2020-02-14 06:21:24 +00:00
else
2020-05-04 09:56:30 +00:00
echo "launcher command Not Found!"
2020-02-14 06:21:24 +00:00
fi
#delete desktop entry
if [ -f "$ENTRY_PATH" ];then
2020-08-17 08:50:18 +00:00
echo "remove desktop entry...."
echo "$SCR_PATH"
2021-01-01 13:28:27 +00:00
rm "$ENTRY_PATH" || error2 "couldn't remove desktop entry"
2020-02-14 06:21:24 +00:00
else
2020-02-14 06:30:19 +00:00
echo "desktop entry Not Found!"
2020-02-14 06:21:24 +00:00
fi
#delete cache directoy
if [ -d "$CACHE_PATH" ];then
2020-02-14 06:30:19 +00:00
echo "--------------------------------"
2020-02-14 06:21:24 +00:00
echo "all downloaded components are in cache directory and you can use them for photoshop installation next time without wasting internet traffic"
2020-02-14 06:34:01 +00:00
echo -e "your cache directory is \033[1;36m$CACHE_PATH\e[0m"
2020-02-14 06:30:19 +00:00
echo "--------------------------------"
2020-02-14 06:21:24 +00:00
ask_question "would you delete cache directory?" "N"
if [ "$result" == "yes" ];then
rm -rf "$CACHE_PATH" || error2 "couldn't remove cache directory"
show_message2 "cache directory removed."
2020-02-14 06:21:24 +00:00
else
echo "nice, you can use downloaded data later for photoshop installation"
2020-02-14 06:21:24 +00:00
fi
else
2020-02-14 06:30:19 +00:00
echo "cache directory Not Found!"
2020-02-14 06:21:24 +00:00
fi
}
2020-02-14 05:33:44 +00:00
#parameters [Message] [default flag [Y/N]]
2021-01-02 13:15:41 +00:00
function ask_question() {
2020-02-14 05:33:44 +00:00
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