how to use libvirt patch
发表于 : 2009-10-26 17:06
The following is a patch of libvirt downloaded from https://bugs.launchpad.net/ubuntu/+sour ... bug/178106, I don't know how to use it , Anybody can help me ? :
代码: 全选
Index: libvirt-0.4.0/debian/libvirt-bin.init
===================================================================
--- libvirt-0.4.0.orig/debian/libvirt-bin.init 2007-12-21 13:59:16.000000000 -0200
+++ libvirt-0.4.0/debian/libvirt-bin.init 2007-12-21 21:11:17.000000000 -0200
@@ -22,7 +22,9 @@
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
+PIDDIR=/var/run/libvirt
PIDFILE=/var/run/$NAME.pid
+
DODTIME=1 # Time to wait for the server to die, in seconds
# Include libvirtd defaults if available
@@ -41,6 +43,12 @@
fi
}
+check_pid_dir() {
+ if [ ! -d "$PIDDIR" ]; then
+ mkdir -p $PIDDIR
+ fi
+}
+
running_pid()
{
# Check if a given process pid's cmdline matches a given name
@@ -89,6 +97,7 @@
case "$1" in
start)
if check_start_libvirtd_option; then
+ check_pid_dir
log_daemon_msg "Starting $DESC" "$NAME"
if running ; then
log_progress_msg "already running"
@@ -120,17 +129,18 @@
force-reload)
# check wether $DAEMON is running. If so, restart
start-stop-daemon --stop --test --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON \
+ $PIDFILE --exec $DAEMON \
&& $0 restart || exit 0
;;
restart)
if check_start_libvirtd_option; then
+ check_pid_dir
log_daemon_msg "Restarting $DESC" "$DAEMON"
start-stop-daemon --oknodo --stop --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON
+ $PIDFILE --exec $DAEMON
[ -n "$DODTIME" ] && sleep $DODTIME
start-stop-daemon --start --quiet --pidfile \
- /var/run/$NAME.pid --exec $DAEMON -- $libvirtd_opts
+ $PIDFILE --exec $DAEMON -- $libvirtd_opts
running && log_end_msg 0 || log_end_msg 1
fi
;;