-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_environment.sh
executable file
·427 lines (366 loc) · 9.29 KB
/
install_environment.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
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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
#! /bin/bash
#VARS
name_script="lib/start_environment.sh"
## Colors
n="\e[0m"
b="\e[0;36m"
r="\e[0;31m"
o="\e[0;33m"
g="\e[1;32m"
#FUCTIONS
toilet_check(){
which toilet
if [ $? != 0 ]
then
apt -y install toilet
fi
}
banner(){
clear
echo
toilet --filter border LOA
echo -e ""$b" Linux On Android$n"
}
install(){
echo
echo " ================ "
echo -e " "$b"Install packages $n"
echo " ================ "
echo
pkg install tur-repo && pkg update
pkg install x11-repo pulseaudio -y
apt install openssl xfce4* firefox chromium -y
}
install_proot(){
echo
echo " ================ "
echo -e " "$b"Install packages $n"
echo " ================ "
echo
pkg install x11-repo pulseaudio -y
apt install openssl -y
}
files(){
echo
echo " ======================== "
echo -e " "$b"Install termux-x11 files $n"
echo " ======================== "
echo
echo "- Install termux-x11.deb..."
echo "--- Install apk..."
sleep 5
termux-open ./lib/termux-x11/termux-x11-universal.apk
read -p "Press enter to continue..." s
echo "--- Install packages..."
pkg install ./lib/termux-x11/termux-x11*.deb -y
apt upgrade -y
echo
if [ "$1" == "vanila" ]
then
echo "- Generate script to enable UI..."
echo
echo "am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity" > ./$name_script
echo "export XDG_RUNTIME_DIR=${TMPDIR}" >> ./$name_script
echo "sleep 2" >> ./$name_script
echo "export DISPLAY=:0" >> ./$name_script
echo "termux-x11 &" >> ./$name_script
echo "sleep 4" >> ./$name_script
echo "pulseaudio --start --load='module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1' --exit-idle-time=-1" >> ./$name_script
echo "xfce4-session --display=:0" >> ./$name_script
chmod u+x $name_script
cp ./$name_script /data/data/com.termux/files/usr/bin/x11vani
if [ -d /data/data/com.termux/files/home/.shortcuts ]
then
mv ./$name_script /data/data/com.termux/files/home/.shortcuts/x11vani
else
mkdir /data/data/com.termux/files/home/.shortcuts
mv ./$name_script /data/data/com.termux/files/home/.shortcuts/x11vani
fi
echo
fi
}
proot_setup(){
chmod u+x ./lib/proot_scripts/install_proot.sh
clear
echo
echo " ===================="
echo -e "$b PRoot Distro install$n"
echo " ===================="
echo
echo -e "- 🟠"$o"Ubuntu$n ------------------------"
echo -e ""$b"1$n. Desktop Environment: "$b"XFCE4$n"
echo -e ""$b"2$n. Desktop Environment: "$b"KDE$n"
echo
echo -e "- 🔴"$r"Debian$n ------------------------"
echo -e ""$b"3$n. Desktop Environment: "$b"XFCE4$n"
echo -e ""$b"4$n. Desktop Environment: "$b"KDE$n"
echo
echo -e "- 🔵"$b"ArchLinux$n ---------------------"
echo -e ""$b"5$n. Desktop Environment: "$b"KDE$n"
echo -e ""$b"6$n. Desktop Environment: "$b"CuteFish$n"
echo -e ""$b"7$n. Desktop Environment: "$b"XFCE4$n"
echo -e ""$b"8$n. Desktop Environment: "$b"LXQT$n"
echo
echo -e "- 🍓"$r"Raspberry OS$n ---------------------"
echo -e ""$b"9$n. Desktop Environment: "$b"LXDE$n"
echo
read -p "What distro and DE (Desktop Environment) use (input number 1..9): " s
case $s in
1)
echo
echo -e "- Installing "$b"Ubuntu$n with DE "$b"XFCE4$n"
#./lib/proot_scripts/install_proot.sh
./lib/proot_scripts/ubuntu/install_xfce_vnc_and_x11.sh
;;
2)
echo
echo -e "- Installing "$b"Ubuntu$n whith DE "$b"KDE$n"
./lib/proot_scripts/ubuntu/install_kde_vnc_and_x11.sh
;;
3)
echo
echo -e "- Installing "$b"Debian$n with DE "$b"XFCE4$n"
#./lib/proot_scripts/install_proot.sh
./lib/proot_scripts/debian/install_xfce_vnc_and_x11.sh
;;
4)
echo
echo -e "- Installing "$b"Debian$n whith DE "$b"KDE$n"
./lib/proot_scripts/debian/install_kde_vnc_and_x11.sh
;;
5)
echo
echo -e "- Installing "$b"ArchLinux$n whith DE "$b"KDE$n"
./lib/proot_scripts/arch/install_kde_vnc_and_x11.sh
;;
6)
echo
echo -e "- Installing "$b"ArchLinux$n whith DE "$b"CuteFish$n"
./lib/proot_scripts/arch/install_cutefish_vnc_and_x11.sh
;;
7)
echo
echo -e "- Installing "$b"ArchLinux$n whith DE "$b"XFCE4$n"
./lib/proot_scripts/arch/install_xfce_vnc_and_x11.sh
;;
8)
echo
echo -e "- Installing "$b"ArchLinux$n whith DE "$b"LXQT$n"
./lib/proot_scripts/arch/install_lxqt_vnc_and_x11.sh
;;
9)
echo
echo -e "- Installing "$r"Raspberry Os$n whith DE "$b"LXDE$n"
./lib/proot_scripts/raspberry_os/install_lxde_vnc_and_x11.sh
;;
esac
}
tweaks(){
grep "# allow-external-apps" "/data/data/com.termux/files/home/.termux/termux.properties" > /dev/null
if [ $? == 0 ]
then
sed -i s/"# allow-external-apps"/"allow-external-apps"/g "/data/data/com.termux/files/home/.termux/termux.properties"
termux-reload-settings
fi
}
chroot_debian(){
lib/chroot_scripts/start_install_debian.sh
}
#DO IT!
toilet_check
banner
case $1 in
vanila)
tweaks
install
files $1
echo -e ""$g"Process completed!$n"
echo
echo -e "
"$g"x11$n:
1. Execute [x11vani] to start x11 environment and proot distro
2. Open app termux-x11
OR
1. Download "$b"termux:widget$n
2. Add termux widget on your home screen
3. Tap on x11vani
4. Open termux-x11
===================
Credits: DJMANRI3
==================="
echo
;;
proot)
tweaks
install_proot
files
proot_setup
echo -e ""$g"Process completed! $n"
echo
;;
chroot_debian)
tweaks
files
chroot_debian
echo -e ""$g"Process completed! $n"
;;
proot_backup)
if [ "$2" == "" ]
then
echo
echo
echo -e "$r[ERROR]"$n" Not parameter 2!"
echo "- <script_name> proot_backup <path/name.tar.gz>"
echo
echo "Setup storage execute command termux-setup-storage in ~/"
echo
echo "Example:"
echo "- <script_name> proot_backup <~/storage/shared/archKDE.tar.gz>"
echo
exit 1
fi
echo
echo
echo "=============="
echo -e ""$b"Backup PRoot$n"
echo "=============="
echo
echo
proot-distro list
echo
echo
read -p "- Alias of distro: " dname
proot-distro backup --output $2 $dname
if [ $? != 0 ]
then
echo
echo -e ""$r"[ERROR]$n Backup of proot distro $dname failled!"
echo
exit 1
else
echo
echo -e ""$g"[OK]$n Backup of proot distro $dname in $2 create"
echo
exit 0
fi
;;
proot_restore)
if [ "$2" == "" ]
then
echo
echo
echo -e "$r[ERROR]"$n" Not parameter 2!"
echo "- <script_name> proot_restore <path>"
echo
echo "Setup storage execute command termux-setup-storage in ~/"
echo
echo "Example:"
echo "- <script_name> proot_restore <~/storage/shared/archKDE.tar.gz>"
echo
exit 1
echo
exit 1
fi
echo
echo
echo "=============="
echo -e ""$b"Restore PRoot$n"
echo "=============="
echo
echo
echo -e "- "$b"Install$n packages... ["$b" tigervnc xorg-xhost proot-distro unzip$n ]"
pkg install tur-repo
apt update && apt install tigervnc xorg-xhost proot-distro unzip x11-repo pulseaudio -y
echo
echo -e "- Install termux-x11..."
files
echo -e "- "$b"Mount storage$n..."
termux-setup-storage
echo -e "- "$b"Restore$n proot distro..."
proot-distro restore $2
echo -e "- Generate command x11arch to start DE (Desktop Environment)..."
gen_startarch
if [ $? != 0 ]
then
echo -e ""$r"[ERROR]$n Generate script file of power on arch failled!"
else
echo -e ""$g"[OK]$n Generate script file of power on arch"
fi
if [ $? == 0 ]
then
echo
echo -e ""$g"Process completed!$n"
echo
exit 0
else
echo
echo -e "$r[ERROR]"$n" Proot Distro no restore"
echo
exit 1
fi
;;
update_proot)
proot_setup
echo
echo -e ""$g"Process completed!$n"
echo
;;
ssh_server)
tweaks
./lib/tools/install_ssh_server.sh
;;
connect_x11)
if [ "$2" == -s ]
then
echo
tweaks;
echo "- Install termux-x11..."
echo "--- Install apk..."
sleep 5
termux-open ./lib/termux-x11/termux-x11-universal.apk
fi
./lib/tools/connect_x11.sh $2
;;
?)
echo
echo "How to execute"
echo
echo " ------- "
echo -e "| "$g"TOOLS$n |"
echo " ------- "
echo -e "$b- <script name> + ssh_server$n: install ssh server"
echo -e "$b- <script name> + connect_x11$n: connect to remote Desktop Environment"
echo -e "$b- <script name> + connect_x11 -s $n: setup connect to remote Desktop Environment"
echo
echo " --------- "
echo -e "| "$g"INSTALL$n |"
echo " ---------"
echo -e "$b- <script name> + vanila$n: install without proot"
echo -e "$b- <script name> + proot $n: install with proot"
echo -e "$b- <script_name> + proot_backup <path/name.tar.gz>$n: create backup of proot distro $b(setup storage 'termux-setup-storage')$n"
echo -e "$b- <script_name> + proot_restore <path/name.tar.gz>$n: restore proot distro $b(setup storage 'termux-setup-storage')$n"
echo -e "$b- <script name> + proot_update$n: update proot"
echo -e "$b- <script name> + chroot_debian$n: install chroot of distro debian "$r"[With ROOT]"$b""
echo
echo " ----------- "
echo -e "| "$g"Start ENV$n |"
echo " ----------- "
echo -e "$b- x11vani$n: start environment installed with option vanilla"
echo -e "$b- x11<distro>$n: start environment installed with proot distros"
echo -e " "$b"ubun$n: "$o"Ubuntu$n"
echo -e " "$b"debi$n: "$r"Debian$n"
echo -e " "$b"arch$n: "$b"Archlinux$n"
echo -e " "$b"pi$n: "$r"Raspbian$n"
echo
exit 0
;;
*)
echo
echo
echo -e "$r[ERROR]"$n" Not parameter!"
echo
echo "If you need help execute <script name> + ?"
echo
exit 1
;;
esac