From 3e27e36ca5f995063612e8833c84de2faef66552 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Tue, 5 Feb 2013 16:19:52 +0000 Subject: hotplug/Linux: Remove hardcoded paths Use xen-hotplugpath.sh (as NetBSD does) which allows PREFIX etc to change. Signed-off-by: Ian Campbell Acked-by: Roger Pau Monne --- tools/hotplug/Linux/init.d/xen-watchdog | 4 +++- tools/hotplug/Linux/init.d/xencommons | 24 ++++++++++++------------ tools/hotplug/Linux/init.d/xend | 16 +++++++++------- tools/hotplug/Linux/init.d/xendomains | 6 ++++-- 4 files changed, 28 insertions(+), 22 deletions(-) (limited to 'tools/hotplug') diff --git a/tools/hotplug/Linux/init.d/xen-watchdog b/tools/hotplug/Linux/init.d/xen-watchdog index 55dd091093..3592fda32d 100644 --- a/tools/hotplug/Linux/init.d/xen-watchdog +++ b/tools/hotplug/Linux/init.d/xen-watchdog @@ -17,7 +17,9 @@ ### END INIT INFO # -DAEMON=/usr/sbin/xenwatchdogd +. /etc/xen/scripts/hotplugpath.sh + +DAEMON=${SBINDIR}/xenwatchdogd base=$(basename $DAEMON) # Source function library. diff --git a/tools/hotplug/Linux/init.d/xencommons b/tools/hotplug/Linux/init.d/xencommons index 20afcc0a3b..a2e633b27a 100644 --- a/tools/hotplug/Linux/init.d/xencommons +++ b/tools/hotplug/Linux/init.d/xencommons @@ -18,6 +18,8 @@ # Description: Starts and stops the daemons neeeded for xl/xend ### END INIT INFO +. /etc/xen/scripts/hotplugpath.sh + if [ -d /etc/sysconfig ]; then xencommons_config=/etc/sysconfig else @@ -72,7 +74,7 @@ do_start () { modprobe blktap2 2>/dev/null || modprobe blktap 2>/dev/null mkdir -p /var/run/xen - if ! `xenstore-read -s / >/dev/null 2>&1` + if ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` then test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="/var/lib/xenstored" rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null @@ -81,19 +83,19 @@ do_start () { if [ -n "$XENSTORED" ] ; then echo -n Starting $XENSTORED... $XENSTORED --pid-file /var/run/xenstored.pid $XENSTORED_ARGS - elif [ -x /usr/sbin/oxenstored ] ; then + elif [ -x ${SBINDIR}/oxenstored ] ; then echo -n Starting oxenstored... - /usr/sbin/oxenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS - elif [ -x /usr/sbin/xenstored ] ; then + ${SBINDIR}/oxenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS + elif [ -x ${SBINDIR}/xenstored ] ; then echo -n Starting C xenstored... - /usr/sbin/xenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS + ${SBINDIR}/xenstored --pid-file /var/run/xenstored.pid $XENSTORED_ARGS else echo "No xenstored found" exit 1 fi # Wait for xenstored to actually come up, timing out after 30 seconds - while [ $time -lt $timeout ] && ! `xenstore-read -s / >/dev/null 2>&1` ; do + while [ $time -lt $timeout ] && ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` ; do echo -n . time=$(($time+1)) sleep 1 @@ -107,16 +109,14 @@ do_start () { fi echo Setting domain 0 name... - xenstore-write "/local/domain/0/name" "Domain-0" + ${BINDIR}/xenstore-write "/local/domain/0/name" "Domain-0" fi echo Starting xenconsoled... test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE" - xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS - test -z "$XENBACKENDD_DEBUG" || XENBACKENDD_ARGS="-d" - test "`uname`" != "NetBSD" || xenbackendd $XENBACKENDD_ARGS + ${SBINDIR}/xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS echo Starting QEMU as disk backend for dom0 - test -z "$QEMU_XEN" && QEMU_XEN=/usr/lib/xen/bin/qemu-system-i386 + test -z "$QEMU_XEN" && QEMU_XEN="${LIBEXEC}/qemu-system-i386" $QEMU_XEN -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize \ -monitor /dev/null -serial /dev/null -parallel /dev/null \ -pidfile $QEMU_PIDFILE @@ -144,7 +144,7 @@ case "$1" in do_start ;; status) - xenstore-read -s / + ${BINDIR}/xenstore-read -s / ;; stop) do_stop diff --git a/tools/hotplug/Linux/init.d/xend b/tools/hotplug/Linux/init.d/xend index 0fd7b1681f..5f92cdc6e9 100755 --- a/tools/hotplug/Linux/init.d/xend +++ b/tools/hotplug/Linux/init.d/xend @@ -18,6 +18,8 @@ # Description: Starts and stops the Xen control daemon. ### END INIT INFO +. /etc/xen/scripts/hotplugpath.sh + shopt -s extglob # Wait for Xend to be up @@ -25,12 +27,12 @@ function await_daemons_up { i=1 rets=10 - xend status + ${SBINDIR}/xend status while [ $? -ne 0 -a $i -lt $rets ]; do sleep 1 echo -n . i=$(($i + 1)) - xend status + ${SBINDIR}/xend status done } @@ -48,21 +50,21 @@ case "$1" in else touch /var/lock/xend fi - xend start + ${SBINDIR}/xend start await_daemons_up ;; stop) - xend stop + ${SBINDIR}/xend stop rm -f /var/lock/subsys/xend /var/lock/xend ;; status) - xend status + ${SBINDIR}/xend status ;; reload) - xend reload + ${SBINDIR}/xend reload ;; restart|force-reload) - xend restart + ${SBINDIR}/xend restart await_daemons_up ;; *) diff --git a/tools/hotplug/Linux/init.d/xendomains b/tools/hotplug/Linux/init.d/xendomains index 00e5944dfd..2a1999a8b2 100644 --- a/tools/hotplug/Linux/init.d/xendomains +++ b/tools/hotplug/Linux/init.d/xendomains @@ -27,11 +27,13 @@ # boots / shuts down. ### END INIT INFO -CMD=xm +. /etc/xen/scripts/hotplugpath.sh + +CMD=${SBINDIR}/xm $CMD list &> /dev/null if test $? -ne 0 then - CMD=xl + CMD=${SBINDIR}/xl fi $CMD list &> /dev/null -- cgit v1.2.3