]> glassweightruler.freedombox.rocks Git - waydroid.git/blob - scripts/run-container.sh
more confs
[waydroid.git] / scripts / run-container.sh
1 #!/bin/bash
2 cd /home/anbox
3
4 if [ ! -e /dev/anbox-hwbinder ] || [ ! -e /dev/ashmem ]; then
5 modprobe binder_linux devices="anbox-binder,anbox-hwbinder,anbox-vndbinder"
6 modprobe ashmem_linux
7 mkdir /dev/binderfs
8 mount -t binder binder /dev/binderfs
9 ln -s /dev/binderfs/* /dev/
10 fi
11 if [ ! -e /dev/anbox-hwbinder ] || [ ! -e /dev/ashmem ]; then
12 echo "ERROR: Binder and ashmem nodes not found!"
13 exit
14 fi
15
16 # just in case, stop Anbox 7
17 stop anbox-container || true
18
19 # start cgroup-lite, else container may fail to start.
20 start cgroup-lite
21 umount -l /sys/fs/cgroup/schedtune
22
23 # start sensors hal
24 anbox-sensord &
25
26 # start anbox-net, that sets up lxc bridge
27 /home/anbox/anbox-net.sh start
28
29 # stop nfcd to not conflict with anbox
30 stop nfcd
31
32 # umount rootfs if it was mounted
33 umount -l rootfs || true
34
35 mount anbox_*_system.img rootfs
36 mount -o remount,ro rootfs
37 mount anbox_*_vendor.img rootfs/vendor
38 mount -o remount,ro rootfs/vendor
39 mount -o bind anbox.prop rootfs/vendor/anbox.prop
40 if [ -d /vendor/lib/egl ]; then
41 mount -o bind /vendor/lib/egl rootfs/vendor/lib/egl
42 fi
43 if [ -d /vendor/lib64/egl ]; then
44 mount -o bind /vendor/lib64/egl rootfs/vendor/lib64/egl
45 fi
46
47 if mountpoint -q -- /odm; then
48 mount -o bind /odm rootfs/odm_extra
49 else
50 if [ -d /vendor/odm ]; then
51 mount -o bind /vendor/odm rootfs/odm_extra
52 fi
53 fi
54
55 # Anbox binder permissions
56 chmod 666 /dev/anbox-*binder
57 chmod 777 /dev/ashmem
58
59 # Wayland and pulse socket permissions
60 XDG_PATH=`cat anbox.prop | grep anbox.xdg_runtime_dir | cut -f 2- -d "="`
61 PULSE_PATH=`cat anbox.prop | grep anbox.pulse_runtime_path | cut -f 2- -d "="`
62 chmod 777 -R $PULSE_PATH
63 chmod 777 -R $XDG_PATH
64
65 # Set sw_sync permissions
66 chmod 777 /dev/sw_sync
67 chmod 777 /sys/kernel/debug/sync/sw_sync
68
69 # Media nodes permissions
70 chmod 777 /dev/Vcodec
71 chmod 777 /dev/MTK_SMI
72 chmod 777 /dev/mdp_sync
73 chmod 777 /dev/mtk_cmdq
74 chmod 777 /dev/video32
75 chmod 777 /dev/video33
76
77 # Graphics nodes permissions
78 chmod 777 -R /dev/dri/*
79 chmod 777 -R /dev/graphics/*
80 chmod 777 -R /dev/fb*
81
82 lxc-start -n anbox -F -- /init