]> glassweightruler.freedombox.rocks Git - waydroid.git/blob - scripts/install.sh
anbox: Set mesa egl and disable ccodec on mainline
[waydroid.git] / scripts / install.sh
1 #!/bin/bash
2
3 SUPPORTED_ARCHS="x86_64 aarch64 armv8l"
4 UNAME_ARCH=`uname -m`
5
6 for a in $SUPPORTED_ARCHS; do
7 if [ $UNAME_ARCH == $a ]; then
8 ARCH=$a
9 fi
10 done
11 if [ -z ${ARCH} ]; then
12 echo "ERROR: Your system with arch $UNAME_ARCH is not supported"
13 exit
14 fi
15 if [ $UNAME_ARCH == "aarch64" ]; then
16 ARCH="arm64"
17 fi
18 if [ $UNAME_ARCH == "armv8l" ]; then
19 ARCH="arm64"
20 fi
21 if [ $UNAME_ARCH == "armv7l" ]; then
22 ARCH="arm"
23 fi
24 if [ $UNAME_ARCH == "i386" ]; then
25 ARCH="x86"
26 fi
27 if [ $UNAME_ARCH == "i686" ]; then
28 ARCH="x86"
29 fi
30
31 echo "Generating device properties"
32 rm -f generate-props.sh
33 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/generate-props.sh
34 chmod +x generate-props.sh
35 . generate-props.sh
36
37 echo "Asking for root access"
38 sudo -s <<EOF
39 mount -o remount,rw /
40
41 mkdir /home/anbox
42 cd /home/anbox
43
44 # remove LD_LIBRARY_PATH from /etc/environment to make life easier
45 if ! grep -q "#LD_LIBRARY_PATH" /etc/environment; then
46 sed -i -e "s/^LD_LIBRARY_PATH/#LD_LIBRARY_PATH/" /etc/environment
47 fi
48
49 echo "Installing packages"
50 apt update
51 apt install -y lxc1
52 apt install -y libgbinder sensorfw-qt5 libsensorfw-qt5-plugins || touch NO_SENSORS
53 if [ ! -f NO_SENSORS ]; then
54 rm anbox-sensors_0.1.0_${ARCH}.deb
55 wget https://github.com/Anbox-halium/anbox-sensors/releases/download/v0.1.0/anbox-sensors_0.1.0_${ARCH}.deb
56 dpkg -i anbox-sensors_0.1.0_${ARCH}.deb || touch NO_SENSORS
57 fi
58
59 echo "Geting anbox images"
60 if [ -f anbox_${ARCH}_system.img ]; then
61 mv anbox_${ARCH}_system.img anbox_${ARCH}_system.img.bak
62 mv anbox_${ARCH}_vendor.img anbox_${ARCH}_vendor.img.bak
63 fi
64 rm -f latest-raw-images.zip
65 wget https://build.lolinet.com/file/lineage/anbox_${ARCH}/latest-raw-images.zip
66 unzip latest-raw-images.zip
67 mkdir -p /home/anbox/rootfs
68 mkdir -p /home/anbox/data
69
70 echo "Geting latest runner script"
71 rm -f run-container.sh
72 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/run-container.sh
73 chmod +x run-container.sh
74 rm -f stop-container.sh
75 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/stop-container.sh
76 chmod +x stop-container.sh
77 rm -f anbox-net.sh
78 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/anbox-net.sh
79 chmod +x anbox-net.sh
80
81 if [ -f anbox.prop ]; then
82 mv anbox.prop anbox.prop.bak
83 fi
84 if grep -q "anbox.display_height" anbox.prop.bak; then
85 grep "anbox.display_height" anbox.prop.bak >> anbox.prop
86 else
87 echo "NOTE: Edit /home/anbox/anbox.prop based on your device screen resolution"
88 echo "anbox.display_height=1920" >> anbox.prop
89 fi
90 if grep -q "anbox.display_width" anbox.prop.bak; then
91 grep "anbox.display_width" anbox.prop.bak >> anbox.prop
92 else
93 echo "NOTE: Edit /home/anbox/anbox.prop based on your device screen resolution"
94 echo "anbox.display_width=1080" >> anbox.prop
95 fi
96 echo "${GRALLOC_PROP}" >> anbox.prop
97 echo "${EGL_PROP}" >> anbox.prop
98 echo "${MEDIA_PROFILES_PROP}" >> anbox.prop
99 echo "${CCODEC_PROP}" >> anbox.prop
100 echo "${EXT_LIB_PROP}" >> anbox.prop
101 echo "${VULKAN_PROP}" >> anbox.prop
102 echo "${DPI_PROP}" >> anbox.prop
103 echo "${GLES_VER_PROP}" >> anbox.prop
104 echo "${XDG_PROP}" >> anbox.prop
105 echo "${WAYLAND_DISP_PROP}" >> anbox.prop
106 echo "${PULSE_PROP}" >> anbox.prop
107 if [ -f NO_SENSORS ]; then
108 echo "anbox.stub_sensors_hal=1" >> anbox.prop
109 rm NO_SENSORS
110 fi
111
112 # TODO: Get rid of this
113 rm -f vendor-fixup.sh
114 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/vendor-fixup.sh
115 chmod +x vendor-fixup.sh
116 ./vendor-fixup.sh $ARCH
117
118 echo "Geting latest lxc config"
119 mkdir /var/lib/lxc/anbox
120 cd /var/lib/lxc/anbox
121 rm -f config*
122 if [ `lxc-info --version | cut -d "." -f 1` -gt 2 ]; then
123 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/lxc-configs/config_2
124 else
125 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/lxc-configs/config_1
126 fi
127 mv config_* config
128 sed -i "s/LXCARCH/$UNAME_ARCH/" config
129 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/lxc-configs/config_nodes
130
131 if ! grep -q "module-native-protocol-unix auth-anonymous=1" /etc/pulse/touch-android9.pa; then
132 echo "Pulseaudio config patching"
133 sed -i "s/module-native-protocol-unix/module-native-protocol-unix auth-anonymous=1/" /etc/pulse/touch-android9.pa
134 fi
135
136 if [ ! -f /etc/gbinder.d/anbox.conf ]; then
137 echo "Adding gbinder config"
138 mkdir /etc/gbinder.d
139 cd /etc/gbinder.d
140 wget https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/gbinder/anbox.conf
141 fi
142
143 mount -o remount,ro /
144
145 echo "Going back to phablet user"
146 EOF
147 cd /home/phablet
148
149 echo "Restarting Pulseaudio service"
150 initctl --user stop pulseaudio
151 initctl --user start pulseaudio
152
153 echo "Installing Finished!"
154 echo "Run anbox container with \"sudo /home/anbox/run-container.sh\" on terminal"
155 echo "Stop anbox container with \"sudo /home/anbox/stop-container.sh\" on terminal"