#!/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() { 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() { if xenstore-read -s / >/dev/null 2>&1; then ewarn "Xenstore can only be started once" return 0 fi local _traceopt= checkpath --directory /var/run/xen ebegin "Starting xenstored daemon" if ! test -f /proc/xen/capabilities && \ ! grep '^xenfs ' /proc/mounts >/dev/null; then mount -t xenfs xenfs /proc/xen fi 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 ebegin "Setting domain0 name record" /usr/bin/xenstore-write "/local/domain/0/name" "Domain-0" eend $* } stop() { ewarn "Xenstore can not be stopped" }