aboutsummaryrefslogtreecommitdiffstats
path: root/main/xen/xenstored.initd
diff options
context:
space:
mode:
Diffstat (limited to 'main/xen/xenstored.initd')
-rw-r--r--main/xen/xenstored.initd53
1 files changed, 53 insertions, 0 deletions
diff --git a/main/xen/xenstored.initd b/main/xen/xenstored.initd
new file mode 100644
index 0000000000..bbb4efb0ce
--- /dev/null
+++ b/main/xen/xenstored.initd
@@ -0,0 +1,53 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/xen-tools/files/xenstored.initd,v 1.2 2011/04/05 21:25:03 alexxy Exp $
+
+depend() {
+ need net
+ before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
+}
+
+wait_xenstored_up() {
+ local time=0 timeout=30
+ while ! xenstore-read -s / >/dev/null 2>&1; do
+ time=$(($time+1))
+ if [ $time -gt $timeout ]; then
+ return 1
+ fi
+ sleep 1
+ done
+ return 0
+}
+
+start() {
+ local _traceopt=
+ ebegin "Starting xenstored daemon"
+ modprobe xen-evtchn 2>/dev/null
+ modprobe xen-gntdev 2>/dev/null
+ modprobe evtchn 2>/dev/null
+ modprobe gntdev 2>/dev/null
+
+ if yesno "$XENSTORED_TRACE"; then
+ _traceopt="-T /var/log/xen/xenstored-trace.log"
+ fi
+
+ start-stop-daemon --start --exec /usr/sbin/xenstored \
+ --pidfile /var/run/xenstored.pid \
+ -- --pid-file=/var/run/xenstored.pid \
+ $XENSTORED_OPTS $_traceopt
+ wait_xenstored_up
+ eend $? || return 1
+
+ einfo "Setting domain0 name record"
+ /usr/bin/xenstore-write "/local/domain/0/name" "Domain-0"
+ eend $*
+}
+
+stop() {
+ ebegin "Stopping xenstored daemon"
+ start-stop-daemon --stop --exec /usr/sbin/xenstored \
+ --pidfile /var/run/xenstored.pid
+ eend $?
+}
+