forked from tech2mar/SteamOS-Waydroid-Installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.sh
More file actions
executable file
·156 lines (124 loc) · 6.46 KB
/
Copy pathfunctions.sh
File metadata and controls
executable file
·156 lines (124 loc) · 6.46 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
#!/bin/bash
# define functions here
mount_waydroid_var () {
# this will initialize and configure custom /var/lib/waydroid
# first make sure /var/lib/waydroid is not mounted
echo -e "$current_password\n" | sudo -S umount /var/lib/waydroid &> /dev/null
echo -e "$current_password\n" | sudo -S losetup -d $(losetup | grep waydroid.img | cut -d " " -f1) &> /dev/null
# prepare the custom /var/lib/waydroid
gunzip -k -f extras/waydroid.img.gz && \
mkfs.ext4 -F extras/waydroid.img && \
ROOTDEV=$(sudo losetup --find --show extras/waydroid.img) && \
echo -e "$current_password\n" | sudo -S mount $ROOTDEV /var/lib/waydroid
}
unmount_waydroid_var () {
# this will unmount the custom /var/lib/waydroid
echo -e "$current_password\n" | sudo -S umount /var/lib/waydroid &> /dev/null
echo -e "$current_password\n" | sudo -S losetup -d $(losetup | grep waydroid.img | cut -d " " -f1) &> /dev/null
}
cleanup_exit () {
# call this function to perform cleanup when a sanity check fails
echo Something went wrong! Performing cleanup. Run the script again to install waydroid.
# remove installed packages
echo -e "$current_password\n" | sudo -S pacman -R --noconfirm libglibutil libgbinder \
python-gbinder waydroid wlroots cage wlr-randr binder_linux-dkms fakeroot debugedit \
dkms plymouth linux-neptune-$(uname -r | cut -d "-" -f5)-headers &> /dev/null
# unmount the custom /var/lib/waydroid
echo -e "$current_password\n" | sudo -S umount /var/lib/waydroid &> /dev/null
echo -e "$current_password\n" | sudo -S losetup -d $(losetup | grep waydroid.img | cut -d " " -f1) &> /dev/null
# delete the waydroid directories
echo -e "$current_password\n" | sudo -S rm -rf /var/lib/waydroid &> /dev/null
# delete waydroid config and scripts
echo -e "$current_password\n" | sudo -S rm /etc/sudoers.d/zzzzzzzz-waydroid /etc/modules-load.d/waydroid.conf /usr/bin/waydroid* &> /dev/null
# delete Waydroid Toolbox and Waydroid Update symlinks
rm ~/Desktop/Waydroid-Updater &> /dev/null
rm ~/Desktop/Waydroid-Toolbox &> /dev/null
# delete Android_Waydroid folder and enable the readonly
echo -e "$current_password\n" | sudo -S rm -rf ~/Android_Waydroid &> /dev/null
echo -e "$current_password\n" | sudo -S steamos-readonly enable &> /dev/null
# re-enable Decky Loader Plugin Loader service
if [ -f $PLUGIN_LOADER ]
then
echo Re-enabling the Decky Loader plugin loader service.
echo -e "$current_password\n" | sudo -S systemctl start plugin_loader.service
fi
echo Cleanup completed. Please open an issue on the GitHub repo or leave a comment on the YT channel - 10MinuteSteamDeckGamer.
exit
}
prepare_custom_image_location () {
# call this function when deploying a custom Android image
# custom Android images needs to be placed in /etc/waydroid-extra/images
# this will create a symlink to /etc/waydroid-extra/images
echo -e "$current_password\n" | sudo mkdir /etc/waydroid-extra &> /dev/null
echo -e "$current_password\n" | sudo -S ln -s /var/lib/waydroid/custom /etc/waydroid-extra/images &> /dev/null
}
download_image () {
local src=$1
local src_hash=$2
local dest=$3
local dest_zip="$dest.zip"
local name=$4
local hash
echo Downloading $name image
echo -e "$current_password\n" | sudo -S curl -o $dest_zip $src -L
hash=$(sha256sum "$dest_zip" | awk '{print $1}')
# Verify the hash
if [[ "$hash" != "$src_hash" ]]; then
echo sha256 hash mismatch for $name image, indicating a corrupted download. This might be due to a network error, you can try again.
cleanup_exit
fi
echo Extracting Archive
echo -e "$current_password\n" | sudo -S unzip -o $dest -d $dest
echo -e "$current_password\n" | sudo -S rm $dest_zip
}
# apply custom config for controller detection, root and fingerprint spoof
apply_android_custom_config () {
# waydroid_base.prop - controller config and disable root
echo "" | sudo tee -a /var/lib/waydroid/waydroid_base.prop > /dev/null
cat extras/waydroid_base.prop | sudo tee -a /var/lib/waydroid/waydroid_base.prop > /dev/null
# waydroid_base.prop fingerprint spoof - check if A11 or A13 and apply the spoof accordingly
if [ "$Android_Choice" == "A13_NO_GAPPS" ] || [ "$Android_Choice" == "A13_GAPPS" ] || [ "$Android_Choice" == "A13_CUSTOM" ]
then
echo "" | sudo tee -a /var/lib/waydroid/waydroid_base.prop > /dev/null
cat extras/android_spoof.prop | sudo tee -a /var/lib/waydroid/waydroid_base.prop > /dev/null
else [ "$Android_Choice" == "TV13_NO_GAPPS" ] || [ "$Android_Choce" == "TV13_GAPPS" ]
echo TV13.
echo "" | sudo tee -a /var/lib/waydroid/waydroid_base.prop > /dev/null
cat extras/androidtv_spoof_sony.prop | sudo tee -a /var/lib/waydroid/waydroid_base.prop
fi
}
# install arm translation layer from casualsnek / aleasto waydroid_script
install_android_extras () {
# casualsnek / aleasto waydroid_script - install libndk / libhoudini and widevine
python3 -m venv $WAYDROID_SCRIPT_DIR/venv
$WAYDROID_SCRIPT_DIR/venv/bin/pip install -r $WAYDROID_SCRIPT_DIR/requirements.txt &> /dev/null
echo "$ARM_Choice installation started:"
echo -e "$current_password\n" | sudo -S $WAYDROID_SCRIPT_DIR/venv/bin/python3 $WAYDROID_SCRIPT_DIR/main.py -a13 install {$ARM_Choice,widevine}
echo casualsnek / aleasto waydroid_script done. $ARM_Choice installed.
echo -e "$current_password\n" | sudo -S rm -rf $WAYDROID_SCRIPT_DIR
}
# install arm translation layer from casualsnek / aleasto waydroid_script. this also includes GAPPS. use this for custom waydroid images
install_android_extras_custom () {
# casualsnek / aleasto waydroid_script - install libndk / libhoudini, widevine and GAPPS
python3 -m venv $WAYDROID_SCRIPT_DIR/venv
$WAYDROID_SCRIPT_DIR/venv/bin/pip install -r $WAYDROID_SCRIPT_DIR/requirements.txt &> /dev/null
echo "$ARM_Choice installation started:"
echo -e "$current_password\n" | sudo -S $WAYDROID_SCRIPT_DIR/venv/bin/python3 $WAYDROID_SCRIPT_DIR/main.py -a13 install {$ARM_Choice,widevine,gapps}
echo casualsnek / aleasto waydroid_script done. $ARM_Choice installed.
echo -e "$current_password\n" | sudo -S rm -rf $WAYDROID_SCRIPT_DIR
}
check_waydroid_init () {
# check if waydroid initialization completed without errors
if [ $? -eq 0 ]
then
echo Waydroid initialization completed without errors!
else
echo Waydroid did not initialize correctly.
echo This could be a hash mismatch / corrupted download.
echo This could also be a python issue. Attach this screenshot when filing a bug report!
echo Output of whereis python - $(whereis python)
echo Output of which python - $(which python)
echo Output of python version - $(python -V)
cleanup_exit
fi
}