[oe-commits] Martin Jansa : syslog-ng: add . inc with common declarations and use u-a for initscript as rsyslog/busybos/ sysklogd does

git version control git at git.openembedded.org
Thu Oct 7 10:18:38 UTC 2010


Module: openembedded.git
Branch: master
Commit: b3bf82db70ed74a6781fc2cc23ea0a8fe0a66f49
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=b3bf82db70ed74a6781fc2cc23ea0a8fe0a66f49

Author: Martin Jansa <Martin.Jansa at gmail.com>
Date:   Thu Oct  7 10:36:17 2010 +0200

syslog-ng: add .inc with common declarations and use u-a for initscript as rsyslog/busybos/sysklogd does

Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>

---

 recipes/syslog-ng/syslog-ng.inc      |   59 ++++++++++++++++++++++++++++++++++
 recipes/syslog-ng/syslog-ng_2.0.5.bb |   32 +-----------------
 2 files changed, 61 insertions(+), 30 deletions(-)

diff --git a/recipes/syslog-ng/syslog-ng.inc b/recipes/syslog-ng/syslog-ng.inc
new file mode 100644
index 0000000..fbe9adf
--- /dev/null
+++ b/recipes/syslog-ng/syslog-ng.inc
@@ -0,0 +1,59 @@
+DESCRIPTION = "Alternative system logger daemon"
+DEPENDS = "libol flex eventlog glib-2.0"
+
+# syslog initscript is handled explicitly because order of
+# update-rc.d and update-alternatives is important
+DEPENDS_append = " update-rc.d update-rc.d-native"
+RDEPENDS_${PN}_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}"
+
+INC_PR = "r3"
+
+inherit autotools
+
+EXTRA_OECONF = "--with-libol=${STAGING_BINDIR_CROSS}/ --enable-dynamic-linking"
+
+do_install_append() {
+        install -d ${D}/${sysconfdir}/${PN}
+        install ${WORKDIR}/syslog-ng.conf ${D}${sysconfdir}/${PN}.conf
+        install -d ${D}/${sysconfdir}/init.d
+        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog.${PN}
+}
+
+CONFFILES_${PN} = "${sysconfdir}/${PN}.conf"
+
+pkg_postinst_${PN} () {
+        update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 50
+
+        if test "x$D" != "x"; then
+                OPT="-r $D"
+        else
+                OPT="-s"
+        fi
+        # remove all rc.d-links potentially created from alternative
+        # syslog packages before creating new ones
+        update-rc.d $OPT -f syslog remove
+        update-rc.d $OPT syslog start 20 2 3 4 5 . stop 90 0 1 6 .
+}
+
+pkg_prerm_${PN} () {
+        if test "x$D" = "x"; then
+                if test "$1" = "upgrade" -o "$1" = "remove"; then
+                        /etc/init.d/syslog stop
+                fi
+        fi
+
+        update-alternatives --remove syslog-init syslog.${PN}
+}
+
+pkg_postrm_${PN} () {
+        if test "x$D" != "x"; then
+                OPT="-r $D"
+        else
+                OPT=""
+        fi
+        if test "$1" = "remove" -o "$1" = "purge"; then
+                if ! test -e "/etc/init.d/syslog"; then
+                        update-rc.d $OPT syslog remove
+                fi
+        fi
+}
diff --git a/recipes/syslog-ng/syslog-ng_2.0.5.bb b/recipes/syslog-ng/syslog-ng_2.0.5.bb
index fe32761..3e914be 100644
--- a/recipes/syslog-ng/syslog-ng_2.0.5.bb
+++ b/recipes/syslog-ng/syslog-ng_2.0.5.bb
@@ -1,37 +1,9 @@
-DESCRIPTION = "Alternative system logger daemon"
-DEPENDS = "libol flex eventlog glib-2.0"
-PR = "r2"
+require syslog-ng.inc
+PR = "${INC_PR}.0"
 
 SRC_URI = "http://www.balabit.com/downloads/files/syslog-ng/sources/2.0/src/${P}.tar.gz \
           file://syslog-ng.conf \
           file://initscript"
 
-S = "${WORKDIR}/${PN}-${PV}"
-
-inherit autotools update-rc.d
-
-EXTRA_OECONF = "--with-libol=${STAGING_BINDIR_CROSS}/ --enable-dynamic-linking"
-
-do_install_append() {
-        install -d ${D}/${sysconfdir}/${PN}
-        install ${WORKDIR}/syslog-ng.conf ${D}${sysconfdir}/syslog-ng.conf
-        install -d ${D}/${sysconfdir}/init.d
-        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog-ng
-}
-
-pkg_postinst() {
-        update-rc.d -f syslog remove
-}
-
-pkg_postrm() {
-        update-rc.d syslog add 5
-}
-
-CONFFILES_${PN} = "${sysconfdir}/syslog-ng.conf"
-
-INITSCRIPT_NAME = "syslog-ng"
-#INITSCRIPT_PARAMS = "defaults 05"
-INITSCRIPT_PARAMS = "remove"
-
 SRC_URI[md5sum] = "c161eefc450fabc246c1a10997c6c6a5"
 SRC_URI[sha256sum] = "34862f87d9d404ad4874d95ee871334f5bc2acad65420f672ad2ee286ab660a1"





More information about the Openembedded-commits mailing list