summaryrefslogtreecommitdiffstats
path: root/recipes/busybox
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/busybox
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/busybox')
-rw-r--r--recipes/busybox/busybox.inc44
1 files changed, 40 insertions, 4 deletions
diff --git a/recipes/busybox/busybox.inc b/recipes/busybox/busybox.inc
index fbcd8ea95f..c6b6422fc1 100644
--- a/recipes/busybox/busybox.inc
+++ b/recipes/busybox/busybox.inc
@@ -11,7 +11,7 @@ LICENSE = "GPLv2"
SECTION = "base"
PRIORITY = "required"
-INC_PR = "r28"
+INC_PR = "r29"
SRC_URI = "\
file://busybox-cron \
@@ -46,12 +46,14 @@ RDEPENDS_${PN} += "${PN}-mountall"
RRECOMMENDS_${PN} += "libgcc ${PN}-syslog"
FILES_${PN}-httpd = "${sysconfdir}/init.d/busybox-httpd /srv/www"
-FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog ${sysconfdir}/syslog.conf"
+FILES_${PN}-syslog = "${sysconfdir}/init.d/syslog.${PN} ${sysconfdir}/syslog.conf"
FILES_${PN}-udhcpd = "${sysconfdir}/init.d/busybox-udhcpd"
FILES_${PN} += "${datadir}/udhcpc"
-INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-syslog ${PN}-udhcpd"
+# syslog initscript is handled explicitly because order of
+# update-rc.d and update-alternatives is important (see below)
+INITSCRIPT_PACKAGES = "${PN}-httpd ${PN}-udhcpd"
INITSCRIPT_NAME_${PN}-httpd = "busybox-httpd"
INITSCRIPT_NAME_${PN}-syslog = "syslog"
INITSCRIPT_NAME_${PN}-udhcpd = "busybox-udhcpd"
@@ -107,7 +109,7 @@ do_install () {
ln -sf busybox ${D}${base_bindir}/sh
if grep -q "CONFIG_SYSLOGD=y" ${WORKDIR}/defconfig; then
- install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/
+ install -m 0755 ${WORKDIR}/syslog ${D}${sysconfdir}/init.d/syslog.${PN}
install -m 644 ${WORKDIR}/syslog.conf ${D}${sysconfdir}/
fi
if grep "CONFIG_CROND=y" ${WORKDIR}/defconfig; then
@@ -157,6 +159,40 @@ pkg_prerm_${PN}-mountall () {
update-alternatives --remove default_mountall mountall.${PN}
}
+pkg_postinst_${PN}-syslog () {
+ 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
+ update-rc.d $OPT syslog defaults
+}
+
+pkg_prerm_${PN}-syslog () {
+ 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}-syslog () {
+ 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
+}
+
pkg_prerm_${PN} () {
# This is so you can make busybox commit suicide - removing busybox with no other packages
# providing its files, this will make update-alternatives work, but the update-rc.d part