openldap: Add initscript
authorOyvind Repvik <nail@nslu2-linux.org>
Mon, 19 Jun 2006 03:15:33 +0000 (03:15 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Mon, 19 Jun 2006 03:15:33 +0000 (03:15 +0000)
packages/openldap/files/initscript [new file with mode: 0644]
packages/openldap/openldap_2.3.11.bb

diff --git a/packages/openldap/files/initscript b/packages/openldap/files/initscript
new file mode 100644 (file)
index 0000000..40881cd
--- /dev/null
@@ -0,0 +1,29 @@
+#! /bin/sh
+#
+# This is an init script for openembedded
+# Copy it to /etc/init.d/openldap and type
+# > update-rc.d openldap defaults 60
+#
+
+
+slapd=/usr/libexec/slapd
+test -x "$slapd" || exit 0
+
+
+case "$1" in
+  start)
+    echo -n "Starting OpenLDAP: "
+    start-stop-daemon --start --quiet --exec $slapd
+    echo "."
+    ;;
+  stop)
+    echo -n "Stopping OpenLDAP: "
+    start-stop-daemon --stop --quiet --pidfile /var/run/slapd.pid
+    echo "."
+    ;;
+  *)
+    echo "Usage: /etc/init.d/openldap {start|stop}"
+    exit 1
+esac
+
+exit 0
\ No newline at end of file
index f15de41..26d017f 100644 (file)
@@ -12,12 +12,13 @@ PRIORITY = "optional"
 LICENSE = "OpenLDAP"
 SECTION = "libs"
 
-PR = "r1"
+PR = "r2"
 
 LDAP_VER = "${@'.'.join(bb.data.getVar('PV',d,1).split('.')[0:2])}"
 
 SRC_URI = "ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz"
 SRC_URI += "file://openldap-m4-pthread.patch;patch=1"
+SCR-URI += "file://initscript";
 # The build tries to run a host executable, this fails.  The patch
 # causes the executable and its data to be installed instead of
 # the output - ucgendat must be run after the ipkg install!
@@ -263,6 +264,23 @@ FILES_${PN}-bin = "${bindir}"
 FILES_${PN}-dev = "${includedir} ${libdir}/lib*.so ${libdir}/*.la ${libdir}/*.a ${libexecdir}/openldap/*.a"
 
 do_install_append() {
+       install -d ${D}${sysconfdir}/init.d
+       cat ${WORKDIR}/initscript > ${D}${sysconfdir}/init.d/openldap
+       chmod 755 ${D}${sysconfdir}/init.d/openldap
        # This is duplicated in /etc/openldap and is for slapd
        rm -f ${D}${localstatedir}/openldap-data/DB_CONFIG.example
 }
+
+pkg_postinst () {
+        if test -n "${D}"; then
+                D="-r $D"
+        fi
+        update-rc.d $D acpid defaults
+}
+
+pkg_prerm () {
+        if test -n "${D}"; then
+                D="-r $D"
+        fi
+        update-rc.d $D acpid remove
+}