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