]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fri Feb 23 12:49:11 IST 2007 Mark McLoughlin <markmc@redhat.com>
authorMark McLoughlin <markmc@redhat.com>
Fri, 23 Feb 2007 12:50:58 +0000 (12:50 +0000)
committerMark McLoughlin <markmc@redhat.com>
Fri, 23 Feb 2007 12:50:58 +0000 (12:50 +0000)
        * qemud/libvirtd.in: add init script for libvirt_qemud

        * qemud/Makefile.am: install it unless we were configured
        with --with-init-scripts=none

        * configure.in: add --with-init-scripts to allow us
        have different flavour init scripts

ChangeLog
configure.in
qemud/.cvsignore
qemud/Makefile.am
qemud/libvirtd.in [new file with mode: 0644]

index 761f806295d0c69fd9aa4f8926da4af1da59cc96..6f8ff3ed8bc54ea5548982f0f17f7d8cf2c25495 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Fri Feb 23 12:49:11 IST 2007 Mark McLoughlin <markmc@redhat.com>
+
+       * qemud/libvirtd.in: add init script for libvirt_qemud
+
+       * qemud/Makefile.am: install it unless we were configured
+       with --with-init-scripts=none
+
+       * configure.in: add --with-init-scripts to allow us
+       have different flavour init scripts
+       
 Fri Feb 23 12:46:44 IST 2007 Mark McLoughlin <markmc@redhat.com>
 
        * qemud/qemud.c: add --pid-file and default to writing
index 618bbe73c329787bdadc19f748fc6b3f85d6f633..6b3f2fdcabb39850351bb8bc9f1385673f665c42 100644 (file)
@@ -101,6 +101,23 @@ fi
 AC_DEFINE_UNQUOTED(QEMUD_PID_FILE, "$QEMUD_PID_FILE", [PID file path for qemud])
 AC_MSG_RESULT($QEMUD_PID_FILE)
 
+dnl
+dnl init script flavor
+dnl
+AC_MSG_CHECKING([for init script flavor])
+AC_ARG_WITH(init-script,
+            AC_HELP_STRING([--with-init-scripts=[redhat|auto|none]],
+                           [Style of init scripts to install (defaults to auto)]))
+if test "x$with_init_scripts" = "x" -o "x$with_init_scripts" = "xauto"; then
+    if test -f /etc/redhat-release ; then
+        with_init_scripts=redhat
+    else
+        with_init_scripts=none
+    fi
+fi
+AM_CONDITIONAL(LIBVIRT_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
+AC_MSG_RESULT($with_init_scripts)
+
 dnl
 dnl allow the creation of iptables rules in chains with a
 dnl specific prefix rather than in the standard toplevel chains
index eddc7eb323b7fe3268aa417129bd9b5dc77fb20b..f5cae4df0bd51788ed73bc991b7e0af14e50bf19 100644 (file)
@@ -5,3 +5,4 @@ Makefile.in
 *.lo
 *.la
 libvirt_qemud
+libvirtd
index 0a70b188c2b2a9c11b44dcc8a3a31297edabb047..34b2cfc18a050f978a91bfa98f515ad30563ac3b 100644 (file)
@@ -19,3 +19,19 @@ libvirt_qemud_LDFLAGS = $(LIBXML_LIBS) $(SYSFS_LIBS)
 libvirt_qemud_DEPENDENCIES =
 libvirt_qemud_LDADD =
 
+EXTRA_DIST = libvirt_qemud.init.in
+
+if LIBVIRT_INIT_SCRIPTS_RED_HAT
+initdir = $(sysconfdir)/rc.d/init.d
+init_SCRIPTS = libvirtd
+
+libvirtd: libvirtd.in
+       sed                                             \
+           -e s!\@localstatedir\@!@localstatedir@!     \
+           -e s!\@sbindir\@!@sbindir@!                 \
+           -e s!\@sysconfdir\@!@sysconfdir@!           \
+           < $< > $@
+       chmod a+x libvirtd
+
+CLEANFILES = libvirtd
+endif # DBUS_INIT_SCRIPTS_RED_HAT
diff --git a/qemud/libvirtd.in b/qemud/libvirtd.in
new file mode 100644 (file)
index 0000000..791e34c
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+# libvirt_qemud:   QEMU and virtual network management daemon
+#
+# chkconfig: 345 97 03
+# description:  This is a daemon for managing QEMU guest instances
+#               and libvirt virtual networks
+#               See http://libvirt.org
+#
+# processname: libvirt_qemud
+# pidfile: @localstatedir@/run/libvirt_qemud.pid
+#
+
+# Sanity checks.
+[ -x @sbindir@/libvirt_qemud ] || exit 0
+
+# Source function library.
+. @sysconfdir@/rc.d/init.d/functions
+
+SERVICE=libvirtd
+PROCESS=libvirt_qemud
+
+
+RETVAL=0
+
+start() {
+    echo -n $"Starting $SERVICE daemon: "
+    daemon --check $SERVICE $PROCESS --system --daemon
+    RETVAL=$?
+    echo
+    [ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
+}
+
+stop() {
+    echo -n $"Stopping $SERVICE daemon: "
+
+    killproc $PROCESS -TERM
+    RETVAL=$?
+    echo
+    if [ $RETVAL -eq 0 ]; then
+        rm -f @localstatedir@/lock/subsys/$SERVICE
+        rm -f @localstatedir@/run/$SERVICE.pid
+    fi
+}
+
+restart() {
+    stop
+    start
+}
+
+reload() {
+    echo -n $"Reloading $SERVICE configuration: "
+
+    killproc $PROCESS -HUP
+    RETVAL=$?
+    echo
+    return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+    start|stop|restart|reload)
+        $1
+        ;;
+    status)
+        status $PROCESS
+        RETVAL=$?
+        ;;
+    condrestart)
+        [ -f @localstatedir@/lock/subsys/$SERVICE ] && restart || :
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
+       exit 1
+        ;;
+esac
+exit $RETVAL