-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinstallation
executable file
·138 lines (122 loc) · 4.09 KB
/
installation
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env bash
## Author: Hakxcore https://github.com/hakxcore
## Colors
currentVersion="2.1.3"
declare -a tools=(cheat cipher covidinfo crypt cryptocurrency define geo gif googler ipinfo jukebox lyrics meme movie news pwned qrify shareterminal shodan shorturl termux-snippets todo transfer weather)
if [[ "$OSTYPE" == linux-android* ]]; then
distro="termux"
platform="Termux"
prefix="/data/data/com.termux/files/"
showError="Try execute install script again."
privilage=""
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 install script again with root privileges."
privilage="sudo "
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 install script again with root privileges."
else
distro="invalid"
fi
fi
installationEnd()
{
echo -n "( •_•)"
sleep .75
echo -n -e "\r( •_•)>⌐■-■"
sleep .75
echo -n -e "\r "
echo -e "\r(⌐■_■)"
sleep .5
echo "Termux Snippets version $currentVersion"
echo "https://github.com/hakxcore/Termux-snippets"
echo -e "\n================= EXIT ==================="
}
installation()
{
echo "___________________________________________"
echo -n "> Installing $1"
if [[ $1 == "weather" ]]; then
cd $1 || return 1
chmod a+x $1
cp $1 $prefix/usr/bin > /dev/null 2>&1 || { echo -e "\n✘ Failure"; echo -e "\nError: $showError"; exit 1; }
echo -e "\n✔Success"
cd ..; installationEnd ; exit 0 || return
elif [[ $1 == "termux-snippets" ]]; then
#cd .. || return 1
chmod a+x $1
cp $1 $prefix/usr/bin > /dev/null 2>&1 || { echo -e "\n✘ Failure"; echo -e "\nError: $showError"; exit 1; }
echo -e "\n✔Success"
elif [[ $1 == "shodan" ]]; then
cd $1 || return 1
pip install shodan
chmod a+x $1
cp $1 $prefix/usr/bin > /dev/null 2>&1 || { echo -e "\n✘ Failure"; echo -e "\nError: $showError"; exit 1; }
echo -e "\n✔Success"
cd .. || return 1
else
cd $1 || return 1
chmod a+x $1
cp $1 $prefix/usr/bin > /dev/null 2>&1 || { echo -e "\n✘ Failure"; echo -e "\nError: $showError"; exit 1; }
echo -e "\n✔Success"
cd .. || return 1
fi
}
updateTool()
{
if [[ -f $prefix/usr/bin/$1 ]]; then
cd $1 || return 1
git pull origin
echo -n "> Installing $BLUE$1$RESETBG "
chmod a+x $1
cp $1 $prefix/usr/bin > /dev/null 2>&1 || { echo -e "\n✘ Failure"; echo -e "\nError: $showError"; exit 1; }
echo ""$GREEN"Success$RESETBG"
cd ..; installationEnd || return 1
fi
}
singleInstall()
{
cd $1 || exit 1
echo -n "> Installing $BLUE$1$RESETBG "
chmod a+x $1
cp $1 $prefix/usr/bin > /dev/null 2>&1 || { echo -e "\n✘ Failure"; echo -e "\nError: $showError"; exit 1; }
echo ""$GREEN" Success$RESETBG"
cd ..; installationEnd || exit 1
}
##Driver
if [[ $2 == "all" ]];then
for tool in "${tools[@]}"; do
installation $tool || exit 1
done
else
for tool in "${@:2}"; do
installation $tool || exit 1
done
fi
if [[ $# == 0 ]]; then
for tool in "${tools[@]}"; do
installation $tool || exit 1
done
elif [[ $1 == "update" ]]; then
echo "> Updating scripts..."
for tool in "${tools[@]}"; do
updateTool $tool || exit 1
done
fi
if [[ $1 == "all" ]]; then
for tool in "${tools[@]}"; do
installation $tool || exit 1
done
else
installation $1 || exit 1
fi