aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/syslog-ng
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2010-10-07 10:36:17 +0200
committerMartin Jansa <Martin.Jansa@gmail.com>2010-10-07 12:16:36 +0200
commitb3bf82db70ed74a6781fc2cc23ea0a8fe0a66f49 (patch)
treee2a321932e3782f6d5ff2c8287013a1cba3bd018 /recipes/syslog-ng
parent20e431e8ba862dd8173cfae28b089d1628d985f5 (diff)
downloadopenembedded-b3bf82db70ed74a6781fc2cc23ea0a8fe0a66f49.tar.gz
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@gmail.com>
Diffstat (limited to 'recipes/syslog-ng')
-rw-r--r--recipes/syslog-ng/syslog-ng.inc59
-rw-r--r--recipes/syslog-ng/syslog-ng_2.0.5.bb32
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 0000000000..fbe9adf623
--- /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 fe32761af0..3e914be0fe 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"