aboutsummaryrefslogtreecommitdiffstats
path: root/main/xen/xendriverdomain.initd
blob: a4956a57bf47f7efb50fb5ad42b99351af4df875 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/sbin/openrc-run

description="Starts and stops xen driver domain daemon"

depend() 
{
        after syslog
}

start() 
{
        # not running in Xen dom0 or domU
        if ! test -d /proc/xen ; then
                exit 0
        fi

        # mount xenfs in dom0 or domU with a pv_ops kernel
        if [ ! -f /proc/xen/capabilities  ] && \
                ! grep '^xenfs ' /proc/mounts >/dev/null;
        then
                mount -t xenfs xenfs /proc/xen
        fi

        # run this script only in domU:
        # no capabilities file in xenlinux domU kernel
        # empty capabilities file in pv_ops domU kernel
        if [ ! -f /proc/xen/capabilities ] || \
                grep -q "control_d" /proc/xen/capabilities ; then
                exit 0
        fi

        [ -n "${PIDFILE}" ] || PIDFILE=/var/run/xldevd.pid

        ebegin "Starting xendriverdomain"

        start-stop-daemon --start --quiet \
                --exec /usr/sbin/xl \
                -- devd --pidfile "${PIDFILE}" $XLDEVD_ARGS
        eend $? "Failed to start xendriverdomain"
}

stop() 
{
        [ -n "${PIDFILE}" ] || PIDFILE=/var/run/xldevd.pid

        ebegin "Stopping xendriverdomain"

        start-stop-daemon --stop --quiet \
                --pidfile "${PIDFILE}"

        eend $? "Failed to stop xendriverdomain"
}