144
by Dimitri John Ledkov
auto update |
1 |
# lxc-android-config - LXC Android Config and Container Initialization |
2 |
#
|
|
3 |
# Configure and initialize the Android container for Ubuntu Touch |
|
4 |
||
5 |
description "lxc android config and container initialization" |
|
6 |
||
7 |
start on cgmanager-ready |
|
8 |
stop on runlevel [06] |
|
9 |
||
10 |
emits android |
|
11 |
||
12 |
console none |
|
13 |
||
14 |
exec lxc-start -n android -F -- /init |
|
15 |
||
16 |
post-start script |
|
17 |
if [ ! -d /dev/cpuctl ] && [ -d /sys/fs/cgroup/cpu ]; then |
|
18 |
mkdir /dev/cpuctl |
|
19 |
mount -t cgroup -o cpu none /sys/fs/cgroup/cpu |
|
20 |
fi
|
|
21 |
||
22 |
lxc-wait -n android -s RUNNING -t 30 |
|
23 |
containerpid="$(lxc-info -n android -p -H)" |
|
24 |
if [ -n "$containerpid" ]; then |
|
25 |
while true; do |
|
26 |
[ -f /proc/$containerpid/root/dev/.coldboot_done ] && break |
|
27 |
sleep 0.1 |
|
28 |
done
|
|
29 |
||
30 |
# Allow custom properties before announcing that the boot is completed |
|
31 |
if [ -f /custom/custom.prop ]; then |
|
32 |
while [ ! -e /dev/socket/property_service ]; do sleep 0.1; done |
|
33 |
grep "^custom\." /custom/custom.prop | sed 's/=/ /' | while read property value; do |
|
34 |
setprop $property $value |
|
35 |
done
|
|
36 |
fi
|
|
37 |
||
38 |
initctl emit android |
|
39 |
else
|
|
40 |
stop; exit 1 |
|
41 |
fi
|
|
42 |
end script |
|
43 |
||
44 |
pre-stop exec lxc-stop -n android -k |