mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
The current usage of LIBEXEC is bogus. It describes the directory for private xen executables. Other places create their own, similar libexecdir path as $prefix/lib/xen/*. Additional two other variables are used to describe similar paths: PRIVATE_BINDIR and PRIVATE_PREFIX The autoconf documentation refers to libexec as a directory for executables and stuff which is called by other programs, not by the user. Adjust all places that want libexecdir as a target path. LIBEXEC refers now to the base directory. Three convenience variables are used to refer to paths to private binaries, libs and include files. In the systemd files LIBEXEC_BIN is substituted, so this variable has to be present in autoconf. All other variables are expanded in Paths.mk because they are only used in Makefiles. Most users of LIBEXEC are updated to use LIBEXEC_BIN because that is what they want. Users of PRIVATE_BINDIR are updated to use LIBEXEC_BIN because that is what they want. PRIVATE_BINDIR and PRIVATE_PREFIX usage is removed by this patch, in favour of LIBXEC_BIN and LIBEXEC An internal libxl function was removed. A single helper to retrieve LIBEXEC_BIN remains. As suggested by the autoconf documentation, configure appends the package name to LIBEXEC to make sure the provided directory really refers to xen. This makes sure "make uninstall" preserves the real libexecdir. Signed-off-by: Olaf Hering <olaf@aepfle.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: George Dunlap <george.dunlap@eu.citrix.com> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Wei Liu <wei.liu2@citrix.com> [ ijc -- ran autogen.sh as requested, updated QEMU_TRADITIONAL_REVISION to pickup version which uses LIBEXEC_BIN ]
150 lines
3.7 KiB
Bash
150 lines
3.7 KiB
Bash
#!/bin/bash
|
|
#
|
|
# xencommons Script to start and stop xenstored and xenconsoled
|
|
#
|
|
# Author: Ian Jackson <ian.jackson@eu.citrix.com>
|
|
#
|
|
# chkconfig: 2345 70 10
|
|
# description: Starts and stops xenstored and xenconsoled
|
|
### BEGIN INIT INFO
|
|
# Provides: xenstored xenconsoled
|
|
# Required-Start: $syslog $remote_fs
|
|
# Should-Start:
|
|
# Required-Stop: $syslog $remote_fs
|
|
# Should-Stop:
|
|
# Default-Start: 2 3 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: Start/stop xenstored and xenconsoled
|
|
# Description: Starts and stops the daemons neeeded for xl/xend
|
|
### END INIT INFO
|
|
|
|
XENSTORED=@XENSTORED@
|
|
|
|
. @XEN_SCRIPT_DIR@/hotplugpath.sh
|
|
|
|
if [ -d /etc/sysconfig ]; then
|
|
xencommons_config=/etc/sysconfig
|
|
else
|
|
xencommons_config=/etc/default
|
|
fi
|
|
|
|
test -f $xencommons_config/xencommons && . $xencommons_config/xencommons
|
|
|
|
XENCONSOLED_PIDFILE=/var/run/xenconsoled.pid
|
|
QEMU_PIDFILE=/var/run/qemu-dom0.pid
|
|
shopt -s extglob
|
|
|
|
# not running in Xen dom0 or domU
|
|
if ! test -d /proc/xen ; then
|
|
exit 0
|
|
fi
|
|
|
|
# mount xenfs in dom0 or domU with a pv_ops kernel
|
|
if test "x$1" = xstart && \
|
|
! test -f /proc/xen/capabilities && \
|
|
! grep '^xenfs ' /proc/mounts >/dev/null;
|
|
then
|
|
mount -t xenfs xenfs /proc/xen
|
|
fi
|
|
|
|
# run this script only in dom0:
|
|
# no capabilities file in xenlinux domU kernel
|
|
# empty capabilities file in pv_ops domU kernel
|
|
if test -f /proc/xen/capabilities && \
|
|
! grep -q "control_d" /proc/xen/capabilities ; then
|
|
exit 0
|
|
fi
|
|
|
|
do_start () {
|
|
local time=0
|
|
local timeout=30
|
|
|
|
@LOAD_MODULES@
|
|
mkdir -p ${XEN_RUN_DIR}
|
|
mkdir -p ${XEN_LOCK_DIR}
|
|
|
|
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
|
|
test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T /var/log/xen/xenstored-trace.log"
|
|
|
|
if [ -n "$XENSTORED" ] ; then
|
|
echo -n Starting $XENSTORED...
|
|
$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 ] && ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1` ; do
|
|
echo -n .
|
|
time=$(($time+1))
|
|
sleep 1
|
|
done
|
|
echo
|
|
|
|
# Exit if we timed out
|
|
if ! [ $time -lt $timeout ] ; then
|
|
echo Could not start xenstored
|
|
exit 1
|
|
fi
|
|
|
|
echo Setting domain 0 name, domid and JSON config...
|
|
${LIBEXEC_BIN}/xen-init-dom0
|
|
fi
|
|
|
|
echo Starting xenconsoled...
|
|
test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE"
|
|
${SBINDIR}/xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
|
|
echo Starting QEMU as disk backend for dom0
|
|
test -z "$QEMU_XEN" && QEMU_XEN="${LIBEXEC_BIN}/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
|
|
}
|
|
do_stop () {
|
|
echo Stopping xenconsoled
|
|
if read 2>/dev/null <$XENCONSOLED_PIDFILE pid; then
|
|
kill $pid
|
|
while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
|
|
rm -f $XENCONSOLED_PIDFILE
|
|
fi
|
|
|
|
echo Stopping QEMU
|
|
if read 2>/dev/null <$QEMU_PIDFILE pid; then
|
|
kill $pid
|
|
while kill -9 $pid >/dev/null 2>&1; do sleep 0.1; done
|
|
rm -f $QEMU_PIDFILE
|
|
fi
|
|
|
|
echo WARNING: Not stopping xenstored, as it cannot be restarted.
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
do_start
|
|
;;
|
|
status)
|
|
${BINDIR}/xenstore-read -s /
|
|
;;
|
|
stop)
|
|
do_stop
|
|
;;
|
|
reload)
|
|
echo >&2 'Reload not available; use force-reload'; exit 1
|
|
;;
|
|
force-reload|restart)
|
|
do_stop
|
|
do_start
|
|
;;
|
|
*)
|
|
# do not advertise unreasonable commands that there is no reason
|
|
# to use with this device
|
|
echo $"Usage: $0 {start|stop|status|restart|force-reload}"
|
|
exit 1
|
|
esac
|
|
|
|
exit $?
|