-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.sh
executable file
·65 lines (60 loc) · 2.46 KB
/
uninstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
BIN_FOLDER=/usr/local/bin/ # Must be in your path to work proper.
DATA_FOLDER="$HOME"/.cache/tingfinder/
CONFIG_FOLDER="$HOME"/.config/tingfinder/
ERRNO=0
echo "This will remove ${BOLD}Tingfinder.py${NORMAL} and all it's settings"
echo ""
echo "${BOLD}Following files and directories will be deleted:${NORMAL}"
echo "- $BIN_FOLDER"tingfinder.py
echo "- $CONFIG_FOLDER"
echo "- $DATA_FOLDER"
echo ""
echo "${BOLD}:: Proceed? [Y/n]${NORMAL}"
read ANSWER
case $ANSWER in
[Yy]|[Yy][Ee][Ss])
printf '\n' ;;
[Nn]|[Nn][Oo])
printf "${BOLD}[!]${NORMAL} No programs or settings was removed. Abandoning process.\n"
exit 0 ;;
*)
printf "${BOLD}[!] ERROR:${NORMAL} Invalid response - quitting.\n" 1>&2
exit 2 ;;
esac
if [ -d $HOME/.cache/tingfinder ]
then
sudo rm -rf $HOME/.cache/tingfinder/
echo "${BOLD}+${NORMAL} Data cache (${BOLD}$DATA_FOLDER${NORMAL}) removed"
else
((ERRNO=ERRNO+1))
echo "${BOLD}! ERROR:${NORMAL} ${BOLD}$DATA_FOLDER${NORMAL} not found - Nothing to remove."
fi
if [ -d $CONFIG_FOLDER ]
then
sudo rm -rf $CONFIG_FOLDER
echo "${BOLD}+${NORMAL} Config folder (${BOLD}$CONFIG_FOLDER${NORMAL}) removed"
else
((ERRNO=ERRNO+1))
echo "${BOLD}! ERROR: $HOME/.config/tingfinder/search-agent.csv${NORMAL} not found - Nothing to remove."
fi
if [ -f /usr/local/bin/tingfinder.py ]
then
sudo rm /usr/local/bin/tingfinder.py
echo "${BOLD}+${NORMAL} "$BIN_FOLDER"tingfinder.py removed"
else
((ERRNO=ERRNO+1))
echo "${BOLD}! ERROR: Tingfinder.py${NORMAL} not found in ${BOLD}$BIN_FOLDER${NORMAL} - Nothing to remove."
fi
echo ""
if [ $ERRNO == 3 ]
then
echo "${BOLD}[!] ERROR:${NORMAL} Nothing to remove - exiting."
elif [ $ERRNO != 0 ]
then
echo "${BOLD}+${NORMAL} Uninstalled with $ERRNO errors."
else
echo "${BOLD}+${NORMAL} Finished job. Tingfinder.py has successfully been removed."
fi