aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/sysklogd
diff options
context:
space:
mode:
authorSteffen Sledz <sledz@dresearch.de>2010-05-07 16:15:57 +0200
committerSteffen Sledz <sledz@dresearch.de>2010-05-17 14:08:13 +0200
commit543d057b7dc9290130a89226b567f2b2140aae0c (patch)
tree926ecfbca3a7f1b687285de2ad7645bfb2b3824f /recipes/sysklogd
parent98bed2876d7dd88cc25f1c70929f1d632b8f95ee (diff)
downloadopenembedded-543d057b7dc9290130a89226b567f2b2140aae0c.tar.gz
busybox/syslogs: use update-alternatives for syslog selection
* u-a for init scripts of busybox-syslog, sysklogd, and rsyslog * syslog-ng needs to be integrated too! Signed-off-by: Steffen Sledz <sledz@dresearch.de> Acked-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'recipes/sysklogd')
-rw-r--r--recipes/sysklogd/sysklogd.inc55
-rw-r--r--recipes/sysklogd/sysklogd_1.4.1.bb2
-rw-r--r--recipes/sysklogd/sysklogd_1.5.bb2
3 files changed, 52 insertions, 7 deletions
diff --git a/recipes/sysklogd/sysklogd.inc b/recipes/sysklogd/sysklogd.inc
index 65da86d835..40177361c8 100644
--- a/recipes/sysklogd/sysklogd.inc
+++ b/recipes/sysklogd/sysklogd.inc
@@ -1,16 +1,20 @@
LICENSE = "GPL"
SECTION = "base"
DESCRIPTION = "The sysklogd package implements two system log daemons."
+INC_PR = "r3"
SRC_URI = "http://www.ibiblio.org/pub/Linux/system/daemons/sysklogd-${PV}.tar.gz \
file://nonrootinstall.patch;patch=1 \
file://sysklogd"
-inherit update-rc.d
-INITSCRIPT_NAME = "sysklogd"
-INITSCRIPT_PARAMS = "start 39 S 1 2 3 . stop 99 0 6 ."
+# syslog initscript is handled explicitly because order of
+# update-rc.d and update-alternatives is important (see below)
+DEPENDS_append = " update-rc.d update-rc.d-native"
+RDEPENDS_${PN}_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}"
+
+INITSCRIPT_NAME = "syslog"
+
CFLAGS_append = " -DSYSV"
-RCONFLICTS = "busybox-syslog"
do_install () {
install -d ${D}${mandir}/man8 \
@@ -23,14 +27,55 @@ do_install () {
install -d ${D}${sysconfdir}
install -m 644 ${S}/syslog.conf ${D}${sysconfdir}/syslog.conf
install -d ${D}${sysconfdir}/init.d
- install -m 755 ${WORKDIR}/sysklogd ${D}${sysconfdir}/init.d/sysklogd
+ install -m 755 ${WORKDIR}/sysklogd ${D}${sysconfdir}/init.d/syslog.${PN}
}
+
+pkg_preinst_${PN} () {
+ # all this is needed to avoid sysmlink errors,
+ # because update-rc.d runs before pkg_postinst :(
+ if [ -e ${sysconfdir}/init.d/syslog -a ! -L ${sysconfdir}/init.d/syslog ]; then
+ echo "WARNING:" "non symlink ${sysconfdir}/init.d/syslog exist -> backup to ${sysconfdir}/init.d/syslog.old"
+ mv ${sysconfdir}/init.d/syslog ${sysconfdir}/init.d/syslog.old
+ fi
+ if [ ! -e ${sysconfdir}/init.d/syslog ]; then
+ ln -s dummy ${sysconfdir}/init.d/syslog
+ fi
+}
+
pkg_postinst_${PN} () {
update-alternatives --install ${base_sbindir}/syslogd syslogd syslogd.${PN} 100
update-alternatives --install ${base_sbindir}/klogd klogd klogd.${PN} 100
+ update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 100
+
+ if test "x$D" != "x"; then
+ OPT="-r $D"
+ else
+ OPT="-s"
+ fi
+ update-rc.d $OPT syslog defaults
}
+
pkg_prerm_${PN} () {
update-alternatives --remove syslogd syslogd.${PN}
update-alternatives --remove klogd klogd.${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/sysklogd/sysklogd_1.4.1.bb b/recipes/sysklogd/sysklogd_1.4.1.bb
index 3d938f5316..e02dd3e876 100644
--- a/recipes/sysklogd/sysklogd_1.4.1.bb
+++ b/recipes/sysklogd/sysklogd_1.4.1.bb
@@ -1,5 +1,5 @@
require sysklogd.inc
-PR = "r1"
+PR = "${INC_PR}.1"
SRC_URI[md5sum] = "d214aa40beabf7bdb0c9b3c64432c774"
diff --git a/recipes/sysklogd/sysklogd_1.5.bb b/recipes/sysklogd/sysklogd_1.5.bb
index 70e55c3eea..a01576897c 100644
--- a/recipes/sysklogd/sysklogd_1.5.bb
+++ b/recipes/sysklogd/sysklogd_1.5.bb
@@ -1,5 +1,5 @@
require sysklogd.inc
-PR = "r2"
+PR = "${INC_PR}.2"
SRC_URI += "file://no-strip-install.patch;patch=1"