~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to vivid/etc/init/lxc-android-config.conf

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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