diff options
Diffstat (limited to 'community/xe-guest-utilities/xe-guest-utilities.initd')
-rw-r--r-- | community/xe-guest-utilities/xe-guest-utilities.initd | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/community/xe-guest-utilities/xe-guest-utilities.initd b/community/xe-guest-utilities/xe-guest-utilities.initd new file mode 100644 index 0000000000..59362ef453 --- /dev/null +++ b/community/xe-guest-utilities/xe-guest-utilities.initd @@ -0,0 +1,50 @@ +#!/sbin/openrc-run + +XE_LINUX_DISTRIBUTION=/usr/sbin/xe-linux-distribution +XE_LINUX_DISTRIBUTION_CACHE=/var/cache/xe-linux-distribution +XE_DAEMON=/usr/sbin/xe-daemon +XE_DAEMON_PIDFILE=/var/run/xe-daemon.pid + +name=xe-daemon +daemon=/usr/sbin/$name + +depend() { + need localmount + after bootmisc +} + +start() { + if [ ! -d /proc/xen ]; then + return + fi + + ebegin "Detecting Linux distribution version" + ${XE_LINUX_DISTRIBUTION} ${XE_LINUX_DISTRIBUTION_CACHE} + eend $? + + if [ ! -e /proc/xen/xenbus ] ; then + ebegin "Mounting xenfs on /proc/xen" + if [ ! -d /proc/xen ] ; then + /bin/false + else + mount -t xenfs none /proc/xen + fi + eend $? + fi + + ebegin "Starting ${name}" + mkdir -p $(dirname ${XE_DAEMON_PIDFILE}) + ( exec &>/dev/null ; ${XE_DAEMON} -p ${XE_DAEMON_PIDFILE} & ) + eend $? +} + +stop() { + if [ ! -d /proc/xen ]; then + return + fi + + ebegin "Stopping ${name}" + kill -TERM $(cat ${XE_DAEMON_PIDFILE}) + eend $? +} + |