-
Notifications
You must be signed in to change notification settings - Fork 1
/
waydroid_10_11_switch.sh
executable file
·80 lines (69 loc) · 2.43 KB
/
waydroid_10_11_switch.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
#!/usr/bin/env bash
# purpose: initiate proper configs for Waydroid 10 or 11
# Will set the following depending on what is detected:
# waydroid.active_apps=Waydroid
#
# Then it will ask if you are using Waydroid 10 or 11 and
# make the proper anbox.conf changes for you
#
# author: Jon West [electrikjesus@gmail.com]
# Verify session type:
# We want to use something different than just $XDG_SESSION_TYPE env variable
# So instead, we will use loginctl:
# loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type
# Expected Result: Type=wayland
# Detect Compositor:
# Mutter: grep -sl mutter /proc/*/maps
isMutter=$(grep -sl mutter /proc/*/maps)
multi_windows=""
wd_active=""
#~ echo "$isMutter"
if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
echo "purpose: "
echo "This will override configs for Waydroid (10/11) by editing"
echo "the waydroid_base.prop found in /var/lib/waydroid/"
echo ""
echo "This will set the following depending on what is selected:"
echo " waydroid.active_apps=Waydroid"
echo ""
echo "Then it will ask if you are using Waydroid 10 or 11 and"
echo "make the proper anbox.conf changes for you"
echo ""
echo "usage:"
echo "Run the script, answer a few questions, done."
echo ""
echo "author: Jon West [electrikjesus@gmail.com]"
echo ""
exit 0
fi
FILENAME='/var/lib/waydroid/waydroid_base.prop'
I=0
for LN in $(cat $FILENAME)
do
if [ "$LN" == "waydroid.active_apps=Waydroid" ]; then
echo "waydroid active detected :)"
wd_active="true"
fi
done
if [ "$wd_active" ]; then
read -p "active mode found. Do you want to disable it (y/n)?" choice
case "$choice" in
y|Y ) echo "yes" && sed -i '/waydroid.active_apps=Waydroid/d' /var/lib/waydroid/waydroid_base.prop;;
n|N ) echo "no";;
* ) echo "invalid";;
esac
else
read -p "Active mode not found. Do you want to enable 'waydroid active' mode (y/n)?" choice
case "$choice" in
y|Y ) echo "yes" && echo "waydroid.active_apps=Waydroid" >> /var/lib/waydroid/waydroid_base.prop;;
n|N ) echo "no";;
* ) echo "invalid";;
esac
fi
read -p "Is this an Android 10 or Android 11 image (10/11)?" choice
case "$choice" in
10 ) echo "10" && sudo sed -i 's/aidl3/aidl2/' /etc/gbinder.d/anbox.conf && sudo sed -i 's/30/29/' /etc/gbinder.d/anbox.conf;;
11 ) echo "11" && sudo sed -i 's/aidl2/aidl3/' /etc/gbinder.d/anbox.conf && sudo sed -i 's/29/30/' /etc/gbinder.d/anbox.conf;;
* ) echo "invalid";;
esac
echo "All Set. Thanks for using!"