summaryrefslogtreecommitdiff
path: root/unmaintained/anbox/anbox-container-manager.initd
blob: d692e052381b88d168df71577f78c61b5f92ebe3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/sbin/openrc-run

supervisor=supervise-daemon

name="Anbox container manager"
command=/usr/bin/anbox
command_args="container-manager --daemon --privileged --data-path=/var/lib/anbox --android-image=/usr/share/anbox/android.img"

depend() {
	need localmount sysfs cgroups fuse
	use net
	after firewall
}

start_pre() {
	# that's all you need to avoid the lxc dependency
	checkpath --directory /usr/lib/lxc
	checkpath --directory /usr/lib/lxc/rootfs

	modprobe loop
	modprobe tun

	if ip link show anbox0 >/dev/null 2>&1; then
		ewarn "anbox0 network interface already exists"
	else
		ebegin "Creating anbox0 network interface"
		/usr/share/anbox/anbox-bridge.sh start
		eend $?
	fi
}

stop_post() {
	if ip link show anbox0 >/dev/null 2>&1; then
		ebegin "Removing anbox0 network interface"
		/usr/share/anbox/anbox-bridge.sh stop
		eend $?
	fi
}