summaryrefslogtreecommitdiff
path: root/app-emulation/xen-tools/files/xenstored.initd
diff options
context:
space:
mode:
Diffstat (limited to 'app-emulation/xen-tools/files/xenstored.initd')
-rw-r--r--app-emulation/xen-tools/files/xenstored.initd44
1 files changed, 44 insertions, 0 deletions
diff --git a/app-emulation/xen-tools/files/xenstored.initd b/app-emulation/xen-tools/files/xenstored.initd
new file mode 100644
index 000000000000..1b7eec92658a
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenstored.initd
@@ -0,0 +1,44 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
+ need xencommons
+}
+
+xenstored_dir_check() {
+ # create dir dynamically
+ local i
+ for i in /var/lock/subsys /run/xen /run/xend/boot /run/xenstored; do
+ [ -x $i ] || mkdir -p $i
+ done
+}
+
+start() {
+ ebegin "Starting xenstored daemon"
+ xenstored_dir_check
+ start-stop-daemon --start --exec /usr/sbin/xenstored \
+ --pidfile /run/xenstored.pid \
+ -- --pid-file=/run/xenstored.pid \
+ $XENSTORED_OPTS
+ until xenstore-exists / || $((15 < ++i))
+ do
+ echo -n .
+ sleep 1
+ done
+ einfo "Setting domain0 name record"
+ /usr/bin/xenstore-write "/local/domain/0/name" "Domain-0"
+ local V=$(xl info| awk "/xen_minor/ { print \$3 }")
+ [ $V -ge 4 ] && /usr/bin/xenstore-write "/local/domain/0/domid" 0
+
+ eend $*
+}
+
+stop() {
+ ebegin "Stopping xenstored daemon"
+ start-stop-daemon --stop --exec /usr/sbin/xenstored \
+ --pidfile /run/xenstored.pid
+ eend $?
+}
+