]> glassweightruler.freedombox.rocks Git - waydroid.git/blob - scripts/install.sh
anbox: Update installer script
[waydroid.git] / scripts / install.sh
1 #!/bin/bash
2
3 echo "Generating device properties"
4 GRALLOC=`getprop ro.hardware.gralloc`
5 if [ -z $GRALLOC ] || [ ! -f /vendor/lib/hw/gralloc.$GRALLOC.so ]; then
6 GRALLOC=`getprop ro.hardware`
7 if [ -z $GRALLOC ] || [ ! -f /vendor/lib/hw/gralloc.$GRALLOC.so ]; then
8 GRALLOC=`getprop ro.product.board`
9 if [ -z $GRALLOC ] || [ ! -f /vendor/lib/hw/gralloc.$GRALLOC.so ]; then
10 GRALLOC=`getprop ro.board.platform`
11 if [ -z $GRALLOC ] || [ ! -f /vendor/lib/hw/gralloc.$GRALLOC.so ]; then
12 GRALLOC=`getprop ro.arch`
13 if [ -z $GRALLOC ] || [ ! -f /vendor/lib/hw/gralloc.$GRALLOC.so ]; then
14 GRALLOC="gbm"
15 fi
16 fi
17 fi
18 fi
19 fi
20 EGL=`getprop ro.hardware.egl`
21 if [ ! -z $EGL ]; then
22 EGL_PROP="ro.hardware.egl=${EGL}"
23 fi
24
25 MEDIA_PROFILES=`getprop media.settings.xml`
26 if [ ! -z $MEDIA_PROFILES ]; then
27 MEDIA_PROFILES_EXTRA=`getprop media.settings.xml | sed "s/vendor/vendor_extra/" | sed "s/odm/odm_extra/"`
28 MEDIA_PROFILES_PROP="media.settings.xml=${MEDIA_PROFILES_EXTRA}"
29 fi
30
31 echo "Asking for root access"
32 sudo -s <<EOF
33 mount -o remount,rw /
34
35 mkdir /home/anbox
36 cd /home/anbox
37
38 # remove LD_LIBRARY_PATH from /etc/environment to make life easier
39 if ! grep -q "#LD_LIBRARY_PATH" /etc/environment; then
40 sed -i -e "s/^LD_LIBRARY_PATH/#LD_LIBRARY_PATH/" /etc/environment
41 fi
42
43 echo "Installing packages"
44 apt update
45 apt install -y qtwayland5 qml-module-qtwayland-compositor
46 rm anbox-sensors_0.1.0_arm64.deb
47 wget https://github.com/Anbox-halium/anbox-sensors/releases/download/v0.1.0/anbox-sensors_0.1.0_arm64.deb
48 dpkg -i anbox-sensors_0.1.0_arm64.deb
49
50 echo "Geting anbox images"
51 if [ -f anbox_arm64_system.img ]; then
52 mv anbox_arm64_system.img anbox_arm64_system.img.bak
53 mv anbox_arm64_vendor.img anbox_arm64_vendor.img.bak
54 fi
55 rm -f latest-raw-images.zip
56 wget https://build.lolinet.com/file/lineage/anbox_arm64/latest-raw-images.zip
57 unzip latest-raw-images.zip
58
59 echo "Geting latest runner script"
60 rm -f run-container.sh
61 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/run-container.sh
62 chmod +x run-container.sh
63
64 if [ -f anbox.prop ]; then
65 mv anbox.prop anbox.prop.bak
66 fi
67 if grep -q "spurv.display_height" anbox.prop.bak; then
68 grep "spurv.display_height" anbox.prop.bak >> anbox.prop
69 else
70 echo "NOTE: Edit /home/anbox/anbox.prop based on your device screen resolution"
71 echo "spurv.display_height=1920" >> anbox.prop
72 fi
73 if grep -q "spurv.display_width" anbox.prop.bak; then
74 grep "spurv.display_width" anbox.prop.bak >> anbox.prop
75 else
76 echo "NOTE: Edit /home/anbox/anbox.prop based on your device screen resolution"
77 echo "spurv.display_width=1080" >> anbox.prop
78 fi
79 echo "ro.hardware.gralloc=${GRALLOC}" >> anbox.prop
80 echo "${EGL_PROP}" >> anbox.prop
81 echo "${MEDIA_PROFILES_PROP}" >> anbox.prop
82
83 echo "Geting latest lxc config"
84 mkdir /var/lib/lxc/anbox
85 cd /var/lib/lxc/anbox
86 rm -f config
87 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/lxc-configs/config
88
89 if ! grep -q "module-native-protocol-unix auth-anonymous=1" /etc/pulse/touch-android9.pa; then
90 echo "Pulseaudio config patching"
91 sed -i "s/module-native-protocol-unix/module-native-protocol-unix auth-anonymous=1/" /etc/pulse/touch-android9.pa
92 fi
93
94 if [ ! -f /etc/gbinder.d/anbox.conf ]; then
95 echo "Adding gbinder config"
96 mkdir /etc/gbinder.d
97 cd /etc/gbinder.d
98 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/gbinder/anbox.conf
99 fi
100
101 mount -o remount,ro /
102
103 echo "Going back to phablet user"
104 EOF
105 cd /home/phablet
106
107 echo "Installing anbox launcher"
108 rm anbox.rudiimmer_1.0_all.click
109 wget https://build.lolinet.com/file/lineage/anbox_arm64/anbox.rudiimmer_1.0_all.click
110 pkcon install-local anbox.rudiimmer_1.0_all.click --allow-untrusted
111
112 echo "Restarting Pulseaudio service"
113 initctl --user stop pulseaudio
114 initctl --user start pulseaudio
115
116 echo "Installing Finished!"
117 echo "Run anbox container with /home/anbox/run-container.sh on terminal"