]> glassweightruler.freedombox.rocks Git - waydroid.git/blob - scripts/install.sh
anbox: Move out vendor fixups from installer script
[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 mkdir -p /home/anbox/rootfs
40 mkdir -p /home/anbox/data
41
42 echo "Geting latest runner script"
43 rm -f run-container.sh
44 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/run-container.sh
45 chmod +x run-container.sh
46 rm -f stop-container.sh
47 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/stop-container.sh
48 chmod +x stop-container.sh
49 rm -f anbox-net.sh
50 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/anbox-net.sh
51 chmod +x anbox-net.sh
52
53 if [ -f anbox.prop ]; then
54 mv anbox.prop anbox.prop.bak
55 fi
56 if grep -q "anbox.display_height" anbox.prop.bak; then
57 grep "anbox.display_height" anbox.prop.bak >> anbox.prop
58 else
59 echo "NOTE: Edit /home/anbox/anbox.prop based on your device screen resolution"
60 echo "anbox.display_height=1920" >> anbox.prop
61 fi
62 if grep -q "anbox.display_width" anbox.prop.bak; then
63 grep "anbox.display_width" anbox.prop.bak >> anbox.prop
64 else
65 echo "NOTE: Edit /home/anbox/anbox.prop based on your device screen resolution"
66 echo "anbox.display_width=1080" >> anbox.prop
67 fi
68 echo "${GRALLOC_PROP}" >> anbox.prop
69 echo "${EGL_PROP}" >> anbox.prop
70 echo "${MEDIA_PROFILES_PROP}" >> anbox.prop
71 echo "${CCODEC_PROP}" >> anbox.prop
72 echo "${EXT_LIB_PROP}" >> anbox.prop
73 echo "${VULKAN_PROP}" >> anbox.prop
74 echo "${DPI_PROP}" >> anbox.prop
75 echo "${GLES_VER_PROP}" >> anbox.prop
76 echo "${XDG_PROP}" >> anbox.prop
77 echo "${WAYLAND_DISP_PROP}" >> anbox.prop
78 echo "${PULSE_PROP}" >> anbox.prop
79 if [ -f NO_SENSORS ]; then
80 echo "anbox.stub_sensors_hal=1" >> anbox.prop
81 rm NO_SENSORS
82 fi
83
84 # TODO: Get rid of this
85 rm -f vendor-fixup.sh
86 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/vendor-fixup.sh
87 chmod +x vendor-fixup.sh
88 ./vendor-fixup.sh
89
90 echo "Geting latest lxc config"
91 mkdir /var/lib/lxc/anbox
92 cd /var/lib/lxc/anbox
93 rm -f config
94 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/lxc-configs/config
95
96 if ! grep -q "module-native-protocol-unix auth-anonymous=1" /etc/pulse/touch-android9.pa; then
97 echo "Pulseaudio config patching"
98 sed -i "s/module-native-protocol-unix/module-native-protocol-unix auth-anonymous=1/" /etc/pulse/touch-android9.pa
99 fi
100
101 if [ ! -f /etc/gbinder.d/anbox.conf ]; then
102 echo "Adding gbinder config"
103 mkdir /etc/gbinder.d
104 cd /etc/gbinder.d
105 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/gbinder/anbox.conf
106 fi
107
108 mount -o remount,ro /
109
110 echo "Going back to phablet user"
111 EOF
112 cd /home/phablet
113
114 echo "Installing anbox launcher"
115 rm anbox.rudiimmer_1.0_all.click
116 wget https://build.lolinet.com/file/lineage/anbox_arm64/anbox.rudiimmer_1.0_all.click
117 pkcon install-local anbox.rudiimmer_1.0_all.click --allow-untrusted
118
119 echo "Restarting Pulseaudio service"
120 initctl --user stop pulseaudio
121 initctl --user start pulseaudio
122
123 echo "Installing Finished!"
124 echo "Run anbox container with \"sudo /home/anbox/run-container.sh\" on terminal"
125 echo "Stop anbox container with \"sudo /home/anbox/stop-container.sh\" on terminal"