aboutsummaryrefslogtreecommitdiffstats
path: root/main/xe-guest-utilities/xe-guest-utilities.initd
diff options
context:
space:
mode:
authorCedric Schieli <cschieli@gmail.com>2010-03-21 12:32:03 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-03-31 08:31:54 +0000
commit29027806d47fb26652308bb1265765a8db82c76f (patch)
treed6532423c12c4a6fa651e387cddc50d32e2c21e3 /main/xe-guest-utilities/xe-guest-utilities.initd
parent95e8811c0c11689b0a75ab12313dc5c45d0204b9 (diff)
downloadaports-29027806d47fb26652308bb1265765a8db82c76f.tar.bz2
aports-29027806d47fb26652308bb1265765a8db82c76f.tar.xz
main/xe-guest-utilities: new aport
Signed-off-by: Cedric Schieli <cschieli@gmail.com>
Diffstat (limited to 'main/xe-guest-utilities/xe-guest-utilities.initd')
-rw-r--r--main/xe-guest-utilities/xe-guest-utilities.initd50
1 files changed, 50 insertions, 0 deletions
diff --git a/main/xe-guest-utilities/xe-guest-utilities.initd b/main/xe-guest-utilities/xe-guest-utilities.initd
new file mode 100644
index 0000000000..2d9c880da7
--- /dev/null
+++ b/main/xe-guest-utilities/xe-guest-utilities.initd
@@ -0,0 +1,50 @@
+#!/sbin/runscript
+
+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 $?
+}
+