-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
364 lines (309 loc) · 9.17 KB
/
install.sh
File metadata and controls
364 lines (309 loc) · 9.17 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
#!/bin/bash
# installer version 1.3
#var
_start=1
_end=100
install_pkg() {
apt update -y
pkg install file -y
pkg install nano -y
pkg install curl -y
pkg install wget -y
pkg install nmap -y
pkg install python -y
pkg install net-tools -y
pkg install termux-api -y
pkg install neofetch -y
}
check_internet_connection() {
printf "\033[1;33m"; echo ""
echo -n " Checking for Internet:"
#DO NOT COPY
ping -c 1 www.google.com > /dev/null 2>&1
if [[ "$?" != 0 ]]
then
# not connected
sleep 1
echo -e "\033[1;31m Not Connected"
sleep 0.7
echo -e "\033[0m Please connect to Internet."
exit 1
else
sleep 0.5
echo -e "\033[1;32m Connected"
sleep 2
clear
fi
}
check_pkg() {
clear
echo " "
echo -e -n "\e[1;32m Checking dependence......."
if ! which python >/dev/null 2>&1; then
sleep 1
echo -e "\e[1;31mFAILED"
sleep 0.7
echo " "
echo -e "\e[1;31m python\e[0m is not installed."
echo -e "\e[1;31m Quitting:\e[0;97m please rerun the script."
exit 1
else
if ! dpkg -s termux-api >/dev/null 2>&1; then
sleep 1
echo -e "\e[1;31mFAILED"
sleep 0.7
echo " "
echo -e "\e[1;31m termux api\e[0m is not installed."
echo -e "\e[1;31m Quitting:\e[0;97m please rerun the script."
exit 1
else
if ! dpkg -s net-tools >/dev/null 2>&1; then
sleep 1
echo -e "\e[1;31mFAILED"
sleep 0.7
echo " "
echo -e "\e[1;31m net-tools\e[0m is not installed."
echo -e "\e[1;31m Quitting:\e[0;97m please rerun the script."
exit 1
else
if ! which wget >/dev/null 2>&1; then
sleep 1
echo -e "\e[1;31mFAILED"
sleep 0.7
echo " "
echo -e "\e[1;31m wget\e[0m is not installed."
echo -e "\e[1;31m Quitting:\e[0;97m please rerun the script."
exit 1
else
if ! which nano >/dev/null 2>&1; then
sleep 1
echo -e "\e[1;31mFAILED"
sleep 0.7
echo " "
echo -e "\e[1;31m nano\e[0m is not installed."
echo -e "\e[1;31m Quitting:\e[0;97m please rerun the script."
exit 1
else
if ! which neofetch >/dev/null 2>&1; then
sleep 1
echo -e "\e[1;31mFAILED"
sleep 0.7
echo " "
echo -e "\e[1;31m neofetch\e[0m is not installed."
echo -e "\e[1;31m Quitting:\e[0;97m please rerun the script."
exit 1
else
if ! which nmap >/dev/null 2>&1; then
sleep 1
echo -e "\e[1;31mFAILED"
sleep 0.7
echo " "
echo -e "\e[1;31m nmap\e[0m is not installed."
echo -e "\e[1;31m Quitting:\e[0;97m please rerun the script."
exit 1
else
if ! which curl >/dev/null 2>&1; then
sleep 1
echo -e "\e[1;31mFAILED"
sleep 0.7
echo " "
echo -e "\e[1;31m curl\e[0m is not installed."
echo -e "\e[1;31m Quitting:\e[0;97m please rerun the script."
exit 1
else
sleep 2
echo -e "\e[1;32mPASSED"
sleep 2.6
echo " "
fi
fi
fi
fi
fi
fi
fi
fi
}
verify_friday() {
if ! sha256sum -c friday.sha256sum | grep "OK" >/dev/null 2>&1; then
echo -e -n "\e[0m Intrigity Test:"
sleep 2
echo -e "\e[1;31m FAILED \e[0m"
sleep 1
echo " "
echo -e " Try downloading Friday again from\e[1;36m https://github.com/thelearn-tech/Friday \e[0m"
sleep 2
exit 1
exit 1
else
echo -e -n "\e[0m Intrigity Test:"
sleep 2
echo -e "\e[32m PASSED"
sleep 1
fi
}
install_friday() {
rm -rf /data/data/com.termux/files/usr/bin/friday
rm -rf $PREFIX/bin/friday
rm -rf /data/data/com.termux/files/usr/home/.Friday
rm -rf $HOME/.Friday
#installing friday
chmod -f +x friday
clear
mv friday /data/data/com.termux/files/usr/bin
mv .Friday /data/data/com.termux/files/home
if [[ -f /data/data/com.termux/files/usr/var/log/Friday/Friday.log ]]
then
echo " "
else
mkdir $PREFIX/var/log/Friday
touch $PREFIX/var/log/Friday/Friday.log
fi
if [[ -f /data/data/com.termux/files/usr/etc/Friday/details.txt ]]
then
echo " "
else
mkdir $PREFIX/etc/Friday
mkdir $PREFIX/etc/Friday/user
touch $PREFIX/etc/Friday/user/details.txt
fi
}
get_details() {
if [[ -f /data/data/com.termux/files/usr/etc/Friday/details.txt ]]
then
echo
else
clear
echo -e "\033[1;32m"
read -p " Specify your gender which is required by chat.py [male/female]: " ugen
sleep 0.7
clear
echo " "
echo -e "\033[1;33m Your gender:\033[1;32m $ugen"
sleep 0.4
echo " "
echo " "
read -p " Is the above information correct. [y/n]: " is_user_happy
echo " "
echo " "
fi
}
ProBar() {
let _progress=(${1}*100/${2}*100)/100
let _done=(${_progress}*4)/10
let _left=40-$_done
_fill=$(printf "%${_done}s")
_empty=$(printf "%${_left}s")
printf "\r\033[1;33m Writing :\033[1;34m [${_fill// /#}${_empty// /-}]\033[1;32m ${_progress}%%"
}
ask() {
echo ""
read -p "Do you want to continue [y/n]: " optiion
if [ $optiion == "Y" ] || [ $optiion == "y" ]; then
clear
echo ""
printf "\033[1;32m"; echo "Installing........"
echo ""
sleep 1
clear
verify_friday
check_internet_connection
install_pkg
check_pkg
install_friday
clear
sleep 1
get_details
if [[ $is_user_happy == "y" ]]
then
for number in $(seq ${_start} ${_end})
do
sleep 0.02
ProBar ${number} ${_end}
done
echo $ugen >> $PREFIX/etc/Friday/user/details.txt
else
clear
echo -e "\e[1;31mplease rerun the script"
exit 1
fi
clear
termux-toast "Friday Installed"
echo " "
printf "\033[1;33m"; echo " Thanks for installing Friday."
echo ""
echo -e "\e[0m type \e[1;32mfriday --help \e[0mto begin."
else
sleep 0.89
clear
printf "\033[1;31m"; echo "user interupt"
echo ""
exit 1
fi
}
banner() {
clear
sleep 0.4
echo -e """
\e[1;32m Wellcome to \e[1;38;5;214m
_____
/ /
,-/-,__ o __/ __. ,
(_/ / (_<_(_/_(_/|_(_/_
/
''
\e[1;32m installation script.
"""
echo -e "\e[0m"
}
if [[ $1 == "--update" ]]
then
if [[ ! -f /data/data/com.termux/files/usr/bin/friday ]]
then
# not found
echo -e "\e[1;31m Friday isn't installed"
exit 1
else
clear
echo -e "\e[0m Updating............."
echo " "
sleep 3
clear
verify_friday
check_internet_connection
install_pkg
install_friday
clear
get_details
if [[ $is_user_happy == "y" ]]
then
for number in $(seq ${_start} ${_end})
do
sleep 0.02
ProBar ${number} ${_end}
done
echo $ugen >> $PREFIX/etc/Friday/user/details.txt
else
echo -e "\e[1;31mplease rerun the script"
exit 1
fi
ver=$(friday --version)
id=$(whoami)
#write log
echo "$id .. $dt __> Upated to $ver" >> $PREFIX/var/log/Friday/Friday.log
sleep 1
clear
echo -e "\e[1;32m Update Finished"
sleep 1
echo " "
echo -e " Friday: \e[0mStarting selftest "
sleep 2.5
friday --self-test
termux-toast "Friday Update Finished"
exit 1
fi
else
banner
ask
exit 1
fi