-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathuninstall
executable file
·87 lines (79 loc) · 2.72 KB
/
uninstall
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
## Author: Hakxcore https://github.com/hakxcore
## colors
RED="$(printf '\033[31m')" GREEN="$(printf '\033[32m')" ORANGE="$(printf '\033[33m')" BLUE="$(printf '\033[34m')"
MAGENTA="$(printf '\033[35m')" CYAN="$(printf '\033[36m')" WHITE="$(printf '\033[37m')" BLACK="$(printf '\033[30m')"
REDBG="$(printf '\033[41m')" GREENBG="$(printf '\033[42m')" ORANGEBG="$(printf '\033[43m')" BLUEBG="$(printf '\033[44m')"
MAGENTABG="$(printf '\033[45m')" CYANBG="$(printf '\033[46m')" WHITEBG="$(printf '\033[47m')" BLACKBG="$(printf '\033[40m')"
RESETBG="$(printf '\e[0m')" BLINK="$(printf '\033[5;31m')"
declare -a tools=(termux-snippets cheat cipher covidinfo crypt cryptocurrency geo gif googler ipinfo jukebox lyrics meme movie news pwned qrify shodan shorturl todo transfer weather)
all="1"
##Platform Check
# if command -v termux-setup-storage
# then
# distr_name=$1
# fi
# if [ "$distr_name" == "Android" ]; then
# platform="Termux"
# prefix="/data/data/com.termux/files/"
# else
# platform="Debian"
# prefix=""
# fi
if [[ "$OSTYPE" == linux-android* ]]; then
distro="termux"
platform="Termux"
prefix="/data/data/com.termux/files/"
showError="Try execute uninstall script again."
fi
if [ -z "$distro" ]; then
distro=$(ls /etc | awk 'match($0, "(.+?)[-_](?:release|version)", groups) {if(groups[1] != "os") {print groups[1]}}')
platform="Debian"
prefix=""
showError="Try running uninstall script again with root privileges."
fi
if [ -z "$distro" ]; then
if [ -f "/etc/os-release" ]; then
distro="$(source /etc/os-release && echo $ID)"
elif [ "$OSTYPE" == "darwin" ]; then
distro="darwin"
platform="Darwin"
prefix=""
showError="Try running uninstall script again with root privileges."
else
distro="invalid"
fi
fi
askUninstall()
{
if [[ -f $prefix/usr/bin/$1 ]]; then
echo -n "$BLUE>$RESETBG Do you wish to uninstall $BLUE$1$RESETBG [Y/n]: "
read -r answer
if [[ "$answer" == [Yy] ]]; then
echo -n "Removing $1: "
rm -f $prefix/usr/bin/$1 > /dev/null 2>&1 || { echo "Failed"; echo $showError; exit 1; }
echo ""$GREEN"Success$RESETBG"
else
all="0"
fi
unset answer
fi
}
removeTool()
{
if [[ -f $prefix/usr/bin/$1 ]]; then
echo -n "Removing $1: "
rm -f $prefix/usr/bin/$1 > /dev/null 2>&1 || { echo "Failed" ; echo $showError; exit 1; }
echo ""$GREEN"Success$RESETBG"
fi
}
##Driver
if [[ $1 != "all" ]]; then
for tool in "${tools[@]}"; do
askUninstall $tool || exit 1
done
else
for tool in "${tools[@]}"; do
removeTool $tool || exit 1
done
fi