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