cherokee: Add an initscript for the cherokee http server so it'll start on
authorJamie Lenehan <lenehan@twibble.org>
Fri, 17 Nov 2006 02:22:07 +0000 (02:22 +0000)
committerJamie Lenehan <lenehan@twibble.org>
Fri, 17 Nov 2006 02:22:07 +0000 (02:22 +0000)
boot, so it'll be stopped when removing it etc.

packages/cherokee/cherokee_0.5.3.bb
packages/cherokee/files/cherokee.init [new file with mode: 0644]

index 596e763..ad5ef94 100644 (file)
@@ -4,15 +4,16 @@ SECTION = "network"
 LICENSE = "GPL"
 DEPENDS = "libpcre gnutls"
 HOMEPAGE = "http://www.cherokee-project.com/"
-PR = "r2"
+PR = "r3"
 
 SRC_URI = "http://www.cherokee-project.com/download/0.5/${PV}/cherokee-${PV}.tar.gz \
          file://configure.patch;patch=1 \
          file://Makefile.in.patch;patch=1 \
          file://Makefile.cget.patch;patch=1 \
-         file://util.patch;patch=1"
+         file://util.patch;patch=1 \
+         file://cherokee.init"
 
-inherit autotools pkgconfig binconfig
+inherit autotools pkgconfig binconfig update-rc.d
 
 EXTRA_OECONF = "--enable-tls=gnutls --disable-static --disable-nls"
 
@@ -26,9 +27,17 @@ do_install_prepend () {
        $BUILD_CC -DHAVE_SYS_STAT_H -o cherokee_replace cherokee_replace.c
 }
 
+do_install_append () {
+        install -m 0755 -d ${D}${sysconfdir}/init.d
+        install -m 755 ${WORKDIR}/cherokee.init ${D}${sysconfdir}/init.d/cherokee
+}
+
 PACKAGES =+ "cget libcherokee-server libcherokee-client libcherokee-base"
 
 FILES_cget = "${bindir}/cget"
 FILES_libcherokee-server = "${libdir}/libcherokee-server*"
 FILES_libcherokee-client = "${libdir}/libcherokee-client*"
 FILES_libcherokee-base = "${libdir}/libcherokee-base*"
+
+INITSCRIPT_NAME = "cherokee"
+INITSCRIPT_PARAMS = "defaults 91 91"
diff --git a/packages/cherokee/files/cherokee.init b/packages/cherokee/files/cherokee.init
new file mode 100644 (file)
index 0000000..0ea0fd3
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+DAEMON=/usr/sbin/cherokee
+CONFIG=/etc/cherokee/cherokee.conf
+PIDFILE=/var/run/cherokee.pid
+NAME="cherokee"
+DESC="Cherokee http server"
+
+test -r /etc/default/cherokee && . /etc/default/cherokee
+test -x "$DAEMON" || exit 0
+test ! -r "$CONFIG" && exit 0
+        
+case "$1" in
+  start)
+    echo "Starting $DESC: "
+    start-stop-daemon --oknodo -S -x $DAEMON -- -b
+    ;;
+
+  stop)
+    echo "Stopping $DESC:"
+    start-stop-daemon -K -p $PIDFILE
+    ;;
+
+  restart)
+    $0 stop >/dev/null 2>&1
+    $0 start
+    ;;
+
+  *)
+    echo "Usage: $0 {start|stop|restart}"
+    exit 0
+    ;;
+esac