forked from pool/libvirt
ed47b0b49d
- Add rpmlintrc to get around suse-filelist-empty error on older distros. - Refactor libvirt spec file to create subpackages for the various libvirtd components. This allows installing a libvirtd tailored for the underlying virtualizer. E.g. on a KVM/QEMU virtualizer only the libvirt-daemon-qemu package needs installed. Similarly, only libvirt-daemon-xen on a Xen virtualizer and libvirt-daemon-lxc on LXC. OBS-URL: https://build.opensuse.org/request/show/177953 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=270
94 lines
2.5 KiB
Bash
94 lines
2.5 KiB
Bash
#!/bin/sh
|
|
|
|
# the following is the LSB init header see
|
|
# http://www.linux-foundation.org/spec//booksets/LSB-Core-generic/LSB-Core-generic.html#INITSCRCOMCONV
|
|
#
|
|
### BEGIN INIT INFO
|
|
# Provides: libvirtd
|
|
# Required-Start: $network $remote_fs
|
|
# Should-Start: xend cgconfig
|
|
# Default-Start: 3 5
|
|
# Required-Stop: $network $remote_fs
|
|
# Should-Stop: xend cgconfig
|
|
# Default-Stop: 0 1 2 4 6
|
|
# Short-Description: daemon for libvirt virtualization API
|
|
# Description: This is a daemon for managing QEMU guest instances
|
|
# and libvirt virtual networks
|
|
# See http://libvirt.org
|
|
### END INIT INFO
|
|
|
|
|
|
LIBVIRTD_BIN=/usr/sbin/libvirtd
|
|
LIBVIRTD_PIDFILE=/var/run/libvirtd.pid
|
|
test -x $LIBVIRTD_BIN || { echo "$LIBVIRD_BIN not installed";
|
|
if [ "$1" = "stop" ]; then exit 0;
|
|
else exit 5; fi; }
|
|
|
|
|
|
. /etc/rc.status
|
|
rc_reset
|
|
|
|
test -f /etc/sysconfig/libvirtd && . /etc/sysconfig/libvirtd
|
|
|
|
LIBVIRTD_CONFIG_ARGS=
|
|
if [ -n "$LIBVIRTD_CONFIG" ]
|
|
then
|
|
LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
|
|
fi
|
|
|
|
case "$1" in
|
|
start)
|
|
if [ -e $LIBVIRTD_PIDFILE ]; then
|
|
if checkproc $LIBVIRTD_BIN ; then
|
|
echo -n "libvirtd is already running."
|
|
rc_status -v
|
|
exit
|
|
else
|
|
echo "Removing stale PID file $LIBVIRTD_PIDFILE."
|
|
rm -f $LIBVIRTD_PIDFILE
|
|
fi
|
|
fi
|
|
echo -n "Starting libvirtd "
|
|
mkdir -p /var/cache/libvirt
|
|
rm -rf /var/cache/libvirt/*
|
|
# LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
|
|
# automatically
|
|
if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
|
|
ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
|
|
fi
|
|
startproc $LIBVIRTD_BIN --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
|
|
rc_status -v
|
|
;;
|
|
stop)
|
|
echo -n "Shutting down libvirtd "
|
|
rm -rf /var/cache/libvirt/*
|
|
killproc -TERM $LIBVIRTD_BIN > /dev/null 2>&1
|
|
rm -f $LIBVIRTD_PIDFILE
|
|
rc_status -v
|
|
;;
|
|
try-restart)
|
|
$0 status >/dev/null && $0 restart
|
|
rc_status
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
$0 start
|
|
rc_status
|
|
;;
|
|
reload)
|
|
killproc -HUP $LIBVIRTD_BIN
|
|
rc_status -v
|
|
;;
|
|
status)
|
|
echo -n "Checking status of libvirtd "
|
|
checkproc $LIBVIRTD_BIN
|
|
rc_status -v
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|try-restart|reload|status}"
|
|
rc_failed 2
|
|
rc_exit
|
|
;;
|
|
esac
|
|
rc_exit
|