1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-23 11:15:13 +03:00
aports/main/xen/xendriverdomain.initd

52 lines
1.3 KiB
Bash

#!/sbin/openrc-run
description="Starts and stops xen driver domain daemon"
depend()
{
after syslog
}
start()
{
# 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 [ ! -f /proc/xen/capabilities ] && \
! grep '^xenfs ' /proc/mounts >/dev/null;
then
mount -t xenfs xenfs /proc/xen
fi
# run this script only in domU:
# no capabilities file in xenlinux domU kernel
# empty capabilities file in pv_ops domU kernel
if [ ! -f /proc/xen/capabilities ] || \
grep -q "control_d" /proc/xen/capabilities ; then
exit 0
fi
[ -n "${PIDFILE}" ] || PIDFILE=/run/xldevd.pid
ebegin "Starting xendriverdomain"
start-stop-daemon --start --quiet \
--exec /usr/sbin/xl \
-- devd --pidfile "${PIDFILE}" $XLDEVD_ARGS
eend $? "Failed to start xendriverdomain"
}
stop()
{
[ -n "${PIDFILE}" ] || PIDFILE=/run/xldevd.pid
ebegin "Stopping xendriverdomain"
start-stop-daemon --stop --quiet \
--pidfile "${PIDFILE}"
eend $? "Failed to stop xendriverdomain"
}