-
Notifications
You must be signed in to change notification settings - Fork 6
/
install_script.sh
491 lines (368 loc) · 15.1 KB
/
install_script.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
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
#!/usr/bin/bash
#check for error function
check(){
if [[ $? -eq 0 ]]; then
continue &> /dev/null
else
echo "Script has failed due to some unknown error"
exit
fi
}
# aurora function
aurora(){
read -p $'\e[32m[\e[35m*\e[32m] \e[1;32mDo you want aurora store installed (y/n[yes/no] - default:- y):\e[0m' aurora
if [[ $aurora == "y" || $aurora == "Y" ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36msetting up aurora store\e[0m"
wget https://tinyurl.com/aurora-store -O aurora.apk
check
# waydroid session start
# check
waydroid app install aurora.apk
check
elif [[ $aurora == "n" || $aurora == "N" ]]; then
continue &> /dev/null
elif [[ $aurora == "" ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36msetting up aurora store\e[0m"
wget https://tinyurl.com/aurora-store -O aurora.apk
check
# waydroid session start
# check
waydroid app install aurora.apk
check
else
echo -e "\e[32m[\e[35m-\e[32m] \e[1;36minvalid option !!!....."
sleep 1
aurora
fi
check
}
#weston function
weston(){
wayland=$(echo $XDG_SESSION_TYPE)
DE=$(echo $XDG_CURRENT_DESKTOP)
if [[ "$wayland" != "wayland" && "$DE" != *"GNOME" ]]; then
sudo cp weston.service ~/.config/systemd/user &> /dev/null
if [[ $? -ne 0 ]];then
sudo mkdir ~/.config/systemd &> /dev/null
sudo mkdir ~/.config/systemd/user &> /dev/null
sudo cp weston.service ~/.config/systemd/user
fi
sudo mkdir /usr/share/wd-launcher
sudo cp waydroid.png /usr/share/wd-launcher/waydroid.png
sudo cp wd-launcher.service ~/.config/systemd/user
sudo cp 'waydroid launcher.desktop' /usr/share/applications
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mInstallation finished\nLaunching waydroid...\e[0m"
echo -e "\e[32m[\e[35m!!!\e[32m] \e[1;31mMajor warning\e[0m: always launch waydroid with \e[1;41mwaydroid launcher desktop icon\e[0m or using \e[1;41msystemctl --user start wd-launcher.service\e[0m from terminal"
systemctl --user start wd-launcher.service
sleep 10
exit
elif [[ "$wayland" != "wayland" && "$DE" == *"GNOME" ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mYour current DE is gnome\e[0m"
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mYou can switch to wayland from the login screen after reboot\e[0m"
read -p $'\e[32m[\e[35m*\e[32m] \e[1;32mDo you wish to continue installing weston service(y/n[yes/no] - default:- n): \e[0m' weston
if [[ $weston == "y" || $weston == "Y" ]]; then
sudo cp weston.service ~/.config/systemd/user &> /dev/null
if [[ $? -ne 0 ]];then
sudo mkdir ~/.config/systemd &> /dev/null
sudo mkdir ~/.config/systemd/user &> /dev/null
sudo cp weston.service ~/.config/systemd/user
fi
sudo mkdir /usr/share/wd-launcher
sudo cp waydroid.png /usr/share/wd-launcher/waydroid.png
sudo cp wd-launcher.service ~/.config/systemd/user
sudo cp 'waydroid launcher.desktop' /usr/share/applications
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mInstallation finished\nLaunching waydroid...\e[0m"
echo -e "\e[32m[\e[35m!!!\e[32m] \e[1;31mMajor warning\e[0m: always launch waydroid with \e[1;41mwaydroid launcher desktop icon\e[0m or using \e[1;41msystemctl --user start wd-launcher.service\e[0m from terminal"
systemctl --user start wd-launcher.service
sleep 10
exit
elif [[ $weston == "n" || $weston == "N" ]]; then
continue &. /dev/null
elif [[ $weston == "" ]]; then
continue &> /dev/null
else
echo -e "\e[32m[\e[35m-\e[32m] \e[1;36minvalid option !!!....."
sleep 1
weston
fi
else
continue &> /dev/null
fi
}
#banner function
banner(){
banner=$(cat /etc/issue)
WHITE="\e[97m"
STOP="\e[0m"
CYAN="\e[1;46m"
if [[ "$banner" == "Arch Linux \r (\l)" ]]; then
pacman -Qi figlet > /dev/null
if [[ $? -eq 0 ]]; then
continue &> /dev/null
else
pacman -S figlet > /dev/null
fi
printf "${WHITE}"
clear
printf "${CYAN}"
figlet -f /usr/share/figlet/fonts/smslant.flf WD-INSTALLER
printf "${STOP}"
else
sudo apt-get install figlet -y > /dev/null
printf "${WHITE}"
clear
printf "${CYAN}"
figlet -f /usr/share/figlet/smslant.flf WD-INSTALLER
printf "${STOP}"
fi
echo -e "\e[1;36m .:.:. \e[0m\e[1;35m creator || n1lby73 \e[1;36m.:.:."
echo " "
echo -e ".:.\e[1;35m telegram: n1lby73 | github: github.com/n1lby73 \e[1;36m.:."
echo -e " .:.\e[1;35minstagram: n1lby73 | twitter: n1l_by73\e[1;36m.:."
}
#Function to check detect vm
check_vm(){
vm=$(hostnamectl | grep "Virtualization")
if [[ -n "$vm" ]]; then
echo "Modifying base prop to run inside virtual machine"
sed -i "s/ro.hardware.gralloc=gbm/#ro.hardware.gralloc=gbm\nro.hardware.gralloc=default/" /var/lib/waydroid/waydroid_base.prop && \
sed -i "s/ro.hardware.egl=mesa/#ro.hardware.egl=mesa\nro.hardware.egl=swiftshader/" /var/lib/waydroid/waydroid_base.prop && \
sudo systemctl restart waydroid-container
fi
}
#function for offline installer
#function to check for directory and files
offline(){
read -p $'\e[32m[\e[35m*\e[32m] \e[1;36mEnter path to build directory: \e[0m' dir
if [[ -d $dir ]]; then
#check if system.img and vendor.img files are in directory
echo -e "\e[32m[\e[35m+\e[32m] \e[1;32mchecking for the following files:\e[0m\n1. system.img\n2. vendor.img"
if [[ -f $dir/system.img && -f $dir/vendor.img ]]; then
echo " "
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36msetting up waydroid\e[0m"
#create a tempoary directory
count to know how many files are there
count=$(ls -A $dir | wc -l)
if [[ $count -eq 2 ]]; then
sudo waydroid init -i $dir
else
sudo mkdir temp
cp $dir/system.img temp
cp $dir/vendor.img temp
sudo waydroid init -i temp
sudo rm -rf temp
sudo systemctl start waydroid-container
fi
else
echo " "
echo -e "\e[32m[\e[35m!\e[32m] \e[1;31mError:- \e[1;32mOne or both files not found, input correct path to directory\e[0m"
sleep 2
offline
fi
else
echo " "
echo -e "\e[32m[\e[35m-\e[32m] \e[1;32mDirectory not found, input correct path to directory\e[0m"
sleep 2
offline
fi
}
#Function for fedora gapps prompt
gapps_fedora(){
read -p $'\e[32m[\e[35m*\e[32m] \e[1;32mDo you want gapps installed (y/n - default:- n): \e[0m' gapps
if [[ $gapps == "n" || $gapps == "N" ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36msetting up waydroid\e[0m"
sudo waydroid init -c https://ota.waydro.id/system -v https://ota.waydro.id/vendor && sudo systemctl enable --now waydroid-container
check
#install aurora store
aurora
check
sleep 1
elif [[ $gapps == "y" || $gapps == "Y" ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36msetting up waydroid\e[0m"
sudo waydroid init -c https://sourceforge.net/projects/waydroid/files/images/system/lineage/waydroid_x86_64/lineage-17.1-20220723-GAPPS-waydroid_x86_64-system.zip/download -v https://ota.waydro.id/vendor && sudo systemctl enable --now waydroid-container
elif [[ $gapps == "" ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36msetting up waydroid with default value\e[0m"
sudo waydroid init -c https://ota.waydro.id/system -v https://ota.waydro.id/vendor && sudo systemctl enable --now waydroid-container
check
#install aurora store
aurora
check
else
echo -e "\e[32m[\e[35m-\e[32m] \e[1;36minvalid option !!!....."
sleep 1
gapps_fedora
fi
}
#Function for debian gapps prompt
gapps_debian(){
read -p $'\e[32m[\e[35m*\e[32m] \e[1;32mDo you want gapps installed (y/n/o[yes/no/offline] - default:- n): \e[0m' gapps
if [[ $gapps == "n" || $gapps == "N" ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36msetting up waydroid\e[0m"
sudo apt-get install waydroid -y
sudo waydroid init
sudo systemctl start waydroid-container
elif [[ $gapps == "y" || $gapps == "Y" ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36msetting up waydroid\e[0m"
sudo apt-get install waydroid -y
sudo waydroid init -s GAPPS
sudo systemctl start waydroid-container
elif [[ $gapps == "o" || $gapps == "O" ]]; then
offline
elif [[ $gapps == "" ]]; then
echo -e "\e[1;32mUsing default value\e[0m"
sudo apt-get install waydroid -y
sudo waydroid init
sudo systemctl start waydroid-container
else
echo -e "\e[32m[\e[35m-\e[32m] \e[1;36minvalid option !!!, restarting now....."
sleep 1
gapps_debian
fi
}
#Function for arch gapps prompt
gapps_arch(){
read -p $'\e[32m[\e[35m+\e[32m] \e[1;32mDo you want gapps installed (y/n/o[yes/no/offline] - default:- n):\e[0m' gapps
if [[ $gapps == "n" || $gapps == "N" ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36msetting up waydroid\e[0m"
sudo yay -S waydroid && waydroid init
elif [[ $gapps == "y" || $gapps == "Y" ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36msetting up waydroid\e[0m"
sudo yay -S waydroid && waydroid init -s GAPPS
elif [[ $gapps == "" ]]; then
echo -e"\e[1;32mInstalling default\e[0m"
sudo yay -S waydroid && waydroid init
elif [[ $gapps == "o" || $gapps == "O" ]]; then
offline
else
echo -e "\e[32m[\e[35m-\e[32m] \e[1;36minvalid option !!!, restarting now....."
sleep 1
gapps_arch
fi
}
#menu function
menu(){
banner
YELLOW="\e[1;33m"
STOP="\e[0m"
printf "${YELLOW}"
echo " "
echo "[01] Debian"
echo " "
echo "[02] Arch"
echo " "
echo "[03] Fedora"
echo " "
read -p $'\e[32m[\e[35m+\e[32m] which distro are you running: ' os
printf "${STOP}"
if [[ $os == 1 || $os == 01 ]];then
# check distro
echo " "
supported_distros=" focal bullseye hirsute jammy ubuntu-devel bookworm bullseye sid "
fallback_distro="focal"
distro=$(lsb_release -sc)
if [[ "$supported_distros" != *" $distro "* ]]; then
echo -e "\e[32m[\e[35m!\e[32m] \e[1;31mWarning\e[0m-: unsupported distribution: "$distro
echo -e "\e[32m[\e[35m!\e[32m] \e[1;31mWarning\e[0m-: using fallback distribution: "$fallback_distro
distro=$fallback_distro
fi
#prerequisite
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mInstalling dependencies....\e[0m"
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install curl python3 python3-gbinder python-pip lxc ca-certificates lxd-client -y
if [[ $? -ne 0 ]]; then
echo " "
echo -e "\e[32m[\e[35m!!!\e[32m] \e[1;31mMajor warning:-\e[0m Dependencies not satisfied\nkindly run '\e[1;41msudo apt-get install curl python3 python3-gbinder python-pip lxc ca-certificates -y && sudo apt-get update && bash requirements.sh\e[0m' manually"
exit 1
fi
echo " "
#add keyring and waydroid repo
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mInstalling repo.....\e[0m"
sudo wget https://repo.waydro.id/waydroid.gpg -O /usr/share/keyrings/waydroid.gpg
check
sudo sh -c "echo 'deb [signed-by=/usr/share/keyrings/waydroid.gpg] https://repo.waydro.id/ $distro main' > /etc/apt/sources.list.d/waydroid.list"
check
sudo apt-get -q update
check
#install waydroid
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mInstalling waydroid....\e[0m"
sleep 0.5
#check which image to install
gapps_debian
check
#check vm
check_vm
check
#check and start weston
weston
check
echo ""
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mInstallation finished\nLaunching waydroid....\e[0m"
wayland_warning=$(echo $XDG_SESSION_TYPE)
if [[ "$wayland_warning" != "wayland" ]]; then
echo -e "\e[32m[\e[35m!!!\e[32m] \e[1;31mMajor warning:-\e[0mSwitch to wayland display server before launching waydroid"
else
waydroid show-full-ui
exit
fi
elif [[ $os == 2 || $os == 02 ]]; then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mInstalling dependencies....\e[0m"
#going to make use of yay
#pacman -Syy wget && wget https://aur.archlinux.org/cgit/aur.git/snapshot/waydroid.tar.gz && tar -xf waydroid.tar.gz -C
sudo pacman -Syu --needed base-devel && git clone https://aur.archlinux.org/yay-bin.git && cd yay-bin && makepkg -si
check
rm -rf yay-bin
check
echo " "
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mInstalling waydroid\e[0m"
sleep 0.5
#check which image to install
gapps_arch
check
#check vm
check_vm
check
#check and start weston
weston
systemctl start waydroid-container
exit
elif [[ $os == 3 || $os == 03 ]];then
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mAdding copr repository\e[0m"
sudo yum update -y
check
sudo dnf copr enable aleasto/waydroid -y
#check for error
check
#check fedora version
version=$(source /etc/os-release && echo $VERSION_ID)
if [[ "$version" -ne 35 ]]; then
continue &> /dev/null
else
sudo dnf update -y
fi
#check for error
check
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mInstalling waydroid\e[0m"
sudo dnf install waydroid -y
#check for error
check
# echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mSetting up waydroid\e[0m"
sleep 0.5
#choose which image to install
gapps_fedora
#check for error
check
#check vm
check_vm
#check and start weston
weston
echo ""
echo -e "\e[32m[\e[35m+\e[32m] \e[1;36mInstallation finished\nLaunching waydroid....\e[0m"
sudo waydroid init
waydroid show-full-ui
exit
else
echo -e "\e[1;36m[!] invalid option !!!, restarting in 5 seconds....."
sleep 5
menu
fi
}
menu