Debian Codegraph @

tools/hotplug/Linux/init.d/xendriverdomain.in

raw
1 #!/bin/sh
2 #
3 # xendriverdomain Script to start services needed in a Xen driver domain
4 #
5 # NOTE: This initscript is not needed on dom0.
6
7 # chkconfig: 2345 70 10
8 # description: Starts and stops xen driver domain daemon
9 ### BEGIN INIT INFO
10 # Provides: xendevd
11 # Required-Start: $syslog $remote_fs
12 # Should-Start:
13 # Required-Stop: $syslog $remote_fs
14 # Should-Stop:
15 # Default-Start: 2 3 5
16 # Default-Stop: 0 1 6
17 # Short-Description: Start/stop xen driver domain daemon
18 # Description: Starts and stops the daemons neeeded for a xen driver domain
19 ### END INIT INFO
20
21 . @XEN_SCRIPT_DIR@/hotplugpath.sh
22
23 xendriverdomain_config=@CONFIG_DIR@/@CONFIG_LEAF_DIR@
24
25 test -f $xendriverdomain_config/xendriverdomain && . $xendriverdomain_config/xendriverdomain
26
27 XLDEVD_PIDFILE=@XEN_RUN_DIR@/xldevd.pid
28
29 # not running in Xen dom0 or domU
30 if ! test -d /proc/xen ; then
31 exit 0
32 fi
33
34 # mount xenfs in dom0 or domU with a pv_ops kernel
35 if test "x$1" = xstart && \
36 ! test -f /proc/xen/capabilities && \
37 ! grep '^xenfs ' /proc/mounts >/dev/null;
38 then
39 mount -t xenfs xenfs /proc/xen
40 fi
41
42 # run this script only in domU:
43 # no capabilities file in xenlinux domU kernel
44 # empty capabilities file in pv_ops domU kernel
45 if ! test -f /proc/xen/capabilities || \
46 grep -q "control_d" /proc/xen/capabilities ; then
47 exit 0
48 fi
49
50 do_start () {
51 echo Starting xl devd...
52 mkdir -p "${XEN_RUN_DIR}"
53 ${sbindir}/xl devd --pidfile=$XLDEVD_PIDFILE $XLDEVD_ARGS
54 }
55 do_stop () {
56 echo Stopping xl devd...
57 if read 2>/dev/null <$XLDEVD_PIDFILE pid; then
58 kill $pid
59 while kill -9 $pid >/dev/null 2>&1; do sleep 1; done
60 rm -f $XLDEVD_PIDFILE
61 fi
62 }
63
64 case "$1" in
65 start)
66 do_start
67 ;;
68 stop)
69 do_stop
70 ;;
71 reload)
72 echo >&2 'Reload not available; use force-reload'; exit 1
73 ;;
74 force-reload|restart)
75 do_stop
76 do_start
77 ;;
78 *)
79 # do not advertise unreasonable commands that there is no reason
80 # to use with this device
81 echo $"Usage: $0 {start|stop|restart|force-reload}"
82 exit 1
83 esac
84
85 exit $?