Skip to contentSkip to conversation

All the syslogs

PATCH Superseded Steffen Sledz 3 participants 21 messages May 6, 2010 – May 17, 2010

lore
Share & tools
lore
#0 lore raw

Since i added the recipe for rsyslog we have three different syslog implemenations in OE: (busybox-)syslog, syslog-ng, and rsyslog.

At the moment syslog-ng and rsyslog have pkg_postinst and pkg_postrm stages which use update-rc.d to deinstall/reinstall init.d links for (busybox-)syslog which is default.

This seems to be a bad hack for me. I believe there must be better solutions for this situation. But I'm not sure which is the preferred. Is this a case for alternatives? Or something like DISTRO_SYSLOG_DAEMON? Or something else?

Steffen

Signature · 8 lines
Steffen Sledz
DResearch Digital Media Systems GmbH
Otto-Schmirgal-Str.3, D-10319 Berlin, Germany
Tel: +49 (30) 515932237 mailto:[email protected]
Fax: +49 (30) 515932299 http://www.DResearch.DE
Geschäftsführer: Dr. Michael Weber, Werner Mögle;
Amtsgericht Berlin Charlottenburg; HRB 54412;
Ust.-IDNr. DE169013825; WEEE Reg.-Nr. DE 85995642
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 4 lines · Steffen Sledz

Since i added the recipe for rsyslog we have three different syslog implemenations in OE: (busybox-)syslog, syslog-ng, and rsyslog.

Quoted 8 lines

At the moment syslog-ng and rsyslog have pkg_postinst and pkg_postrm stages which use update-rc.d to deinstall/reinstall init.d links for (busybox-)syslog which is default.

This seems to be a bad hack for me. I believe there must be better solutions for this situation. But I'm not sure which is the preferred. Is this a case for alternatives? Or something like DISTRO_SYSLOG_DAEMON? Or something else?

DISTRO_* is the wrong namespace for that, it's a per-image choice. You could have a look at using u-a to changing initscripts and binaries.

regards,

Koen
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFL4l4hMkyGM64RGpERAmQGAKCnBaQCn4e8UJw7I4M+pbIJKVDUPACfa+fR WHGvccUmsPf+1TDjDjiKtJ0=
=U2rv
-----END PGP SIGNATURE-----

#2 lore raw

Am 06.05.2010 08:13, wrote Koen Kooi:

Quoted 8 lines
Quoted 7 lines

Since i added the recipe for rsyslog we have three different syslog implemenations in OE: (busybox-)syslog, syslog-ng, and rsyslog.

At the moment syslog-ng and rsyslog have pkg_postinst and pkg_postrm stages which use update-rc.d to deinstall/reinstall init.d links for (busybox-)syslog which is default.

Quoted 7 lines
Quoted 4 lines

This seems to be a bad hack for me. I believe there must be better solutions for this situation. But I'm not sure which is the preferred. Is this a case for alternatives? Or something like DISTRO_SYSLOG_DAEMON? Or something else?

DISTRO_* is the wrong namespace for that, it's a per-image choice. You could have a look at using u-a to changing initscripts and binaries.

OK, than i'll try to create an u-a setting for all the syslogs (btw: we have not three but four different ones, there's sysklogd too).

Has anyone combined update-alternatives and update-rc.d for initscripts before? I'm afraid there are some pitfalls in the naming of the initscript itself and the symlinks.

Regards,
Steffen

#3 lore raw
Quoted 6 lines

OK, than i'll try to create an u-a setting for all the syslogs (btw: we have not three but four different ones, there's sysklogd too).

Has anyone combined update-alternatives and update-rc.d for initscripts before? I'm afraid there are some pitfalls in the naming of the initscript itself and the symlinks.

I made some first tests and they confirmed my fears. :(

The recipes look like this:

-------------------->snip<--------------------------- inherit autotools update-rc.d

do_install_append() {
        ...
        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog.${PN}
}
pkg_postinst_${PN} () {
    update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 300
}
pkg_prerm_${PN} () {
    update-alternatives --remove syslog-init syslog.${PN}
}

INITSCRIPT_NAME = "syslog" -------------------->snip<---------------------------

When opkg installs the packages it wants to run update-rc.d *before* update-alternatives. This results in an "file does not exist" error. :(

Installing rsyslog (5.5.4-r1.0.5) to root...
Installing busybox-syslog (1.13.2-r24.1.5) to root... Configuring rsyslog
update-rc.d: /etc/init.d/syslog: file does not exist
update-alternatives: Linking //etc/init.d/syslog to syslog.rsyslog

Any suggestions?

Regards,
Steffen

Signature · 8 lines
Steffen Sledz
DResearch Digital Media Systems GmbH
Otto-Schmirgal-Str.3, D-10319 Berlin, Germany
Tel: +49 (30) 515932237 mailto:[email protected]
Fax: +49 (30) 515932299 http://www.DResearch.DE
Geschäftsführer: Dr. Michael Weber, Werner Mögle;
Amtsgericht Berlin Charlottenburg; HRB 54412;
Ust.-IDNr. DE169013825; WEEE Reg.-Nr. DE 85995642
#4 lore raw
Quoted 33 lines · Steffen Sledz
Quoted 6 lines

OK, than i'll try to create an u-a setting for all the syslogs (btw: we have not three but four different ones, there's sysklogd too).

Has anyone combined update-alternatives and update-rc.d for initscripts before? I'm afraid there are some pitfalls in the naming of the initscript itself and the symlinks.

I made some first tests and they confirmed my fears. :(

The recipes look like this:

-------------------->snip<--------------------------- inherit autotools update-rc.d

do_install_append() {
        ...
        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog.${PN}
}
pkg_postinst_${PN} () {
    update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 300
}
pkg_prerm_${PN} () {
    update-alternatives --remove syslog-init syslog.${PN}
}

INITSCRIPT_NAME = "syslog" -------------------->snip<---------------------------

When opkg installs the packages it wants to run update-rc.d *before* update-alternatives. This results in an "file does not exist" error. :(

Quoted 6 lines

Installing rsyslog (5.5.4-r1.0.5) to root...
Installing busybox-syslog (1.13.2-r24.1.5) to root... Configuring rsyslog
update-rc.d: /etc/init.d/syslog: file does not exist
update-alternatives: Linking //etc/init.d/syslog to syslog.rsyslog
Any suggestions?

If there is only one u-a file in recipe you can try
inherit update-alternatives to see if it will generate postinst commands in right order.

Or in worse case, move update-rc.d logic to your postinst scripts after setting u-a links.

Regards,

Signature · 3 lines
uin:136542059                jid:[email protected]
Jansa Martin                 sip:[email protected] 
JaMa                         
#5 lore raw

Am 07.05.2010 13:09, schrieb Martin Jansa:

Quoted 10 lines
Quoted 9 lines

When opkg installs the packages it wants to run update-rc.d *before* update-alternatives. This results in an "file does not exist" error. :(

Installing rsyslog (5.5.4-r1.0.5) to root...
Installing busybox-syslog (1.13.2-r24.1.5) to root... Configuring rsyslog
update-rc.d: /etc/init.d/syslog: file does not exist
update-alternatives: Linking //etc/init.d/syslog to syslog.rsyslog
Any suggestions?

Quoted 3 lines

If there is only one u-a file in recipe you can try
inherit update-alternatives to see if it will generate postinst commands in right order.

Sorry, sometimes more than one.

Quoted 2 lines

Or in worse case, move update-rc.d logic to your postinst scripts after setting u-a links.

Would be a

touch {sysconfdir}/init.d/syslog

in pkg_preinst_${PN} be acceptable? It worked well in my test.

Regards,
Steffen

#6 lore raw
Quoted 11 lines · Steffen Sledz

Am 07.05.2010 13:09, schrieb Martin Jansa:

Quoted 10 lines
Quoted 9 lines

When opkg installs the packages it wants to run update-rc.d *before* update-alternatives. This results in an "file does not exist" error. :(

Installing rsyslog (5.5.4-r1.0.5) to root...
Installing busybox-syslog (1.13.2-r24.1.5) to root... Configuring rsyslog
update-rc.d: /etc/init.d/syslog: file does not exist
update-alternatives: Linking //etc/init.d/syslog to syslog.rsyslog
Any suggestions?

Quoted 5 lines
Quoted 3 lines

If there is only one u-a file in recipe you can try
inherit update-alternatives to see if it will generate postinst commands in right order.

Sorry, sometimes more than one.

Yeah sort of expected that :/.

Quoted 6 lines
Quoted 2 lines

Or in worse case, move update-rc.d logic to your postinst scripts after setting u-a links.

Would be a

touch {sysconfdir}/init.d/syslog

:) also option, but u-a should at least show warning that link file is not and link and in worse scenario refuse to replace non-link file with link to alternative (IIRC the case for u-a-cworth and his variant included in opkg).

What I had in mind was adding:
update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} after u-a call in postinst and similar update-rc.d $OPT ${INITSCRIPT_NAME} remove
in postrm, etc.

Regards,

Signature · 3 lines
uin:136542059                jid:[email protected]
Jansa Martin                 sip:[email protected] 
JaMa                         
#7 lore raw
Quoted 9 lines
Quoted 3 lines

Would be a

touch {sysconfdir}/init.d/syslog

:) also option, but u-a should at least show warning that link file is not and link and in worse scenario refuse to replace non-link file with link to alternative (IIRC the case for u-a-cworth and his variant included in opkg).

Quoted 5 lines

What I had in mind was adding:
update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} after u-a call in postinst and similar update-rc.d $OPT ${INITSCRIPT_NAME} remove
in postrm, etc.

I would prefer my method because the update-rc.d class does a bit more than just calling update-rc.d (e.g. stop running services). And i thing it's not a good idea to duplicate the whole code.

Regards,
Steffen

#8 lore raw

PATCH 1/1 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!

---
 recipes/busybox/busybox.inc        |   18 ++++++++++++++++--
 recipes/rsyslog/rsyslog.inc        |   22 +++++++++++++---------
 recipes/sysklogd/sysklogd.inc      |   19 +++++++++++++++----
 recipes/sysklogd/sysklogd_1.4.1.bb |    2 +-
 recipes/sysklogd/sysklogd_1.5.bb   |    2 +-
 5 files changed, 46 insertions(+), 17 deletions(-)
recipes/busybox/busybox.inc +16 -2
index 17d8d14..31651d6 100644
@@ -11,7 +11,7 @@ LICENSE = "GPLv2"
 SECTION = "base"
 PRIORITY = "required"
 
-INC_PR = "r27"
+INC_PR = "r28"
 
 SRC_URI = "\
   file://busybox-cron \
@@ -46,7 +46,7 @@ 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"
@@ -154,6 +154,20 @@ pkg_prerm_${PN}-mountall () {
 	update-alternatives --remove default_mountall mountall.${PN}
 }
 
+pkg_preinst_${PN}-syslog () {
+    # this is needed to avoid sysmlink errors,
+    # because update-rc.d runs before pkg_postinst :(
+    touch {sysconfdir}/init.d/syslog
+}
+
+pkg_postinst_${PN}-syslog () {
+    update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 50
+}
+
+pkg_prerm_${PN}-syslog () {
+    update-alternatives --remove syslog-init syslog.${PN}
+}
+
 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
recipes/rsyslog/rsyslog.inc +13 -9
index 3e39ba0..6471724 100644
@@ -2,7 +2,7 @@ DESCRIPTION = "Rsyslog is an enhanced multi-threaded syslogd"
 DEPENDS = "zlib"
 HOMEPAGE = "http://www.rsyslog.com/"
 LICENSE = "GPLv3"
-INC_PR = "r0"
+INC_PR = "r1"
 
 SRC_URI = "http://download.rsyslog.com/rsyslog/${PN}-${PV}.tar.gz \
           file://rsyslog.conf \
@@ -14,19 +14,23 @@ do_install_append() {
         install -d ${D}/${sysconfdir}/${PN}
         install ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
         install -d ${D}/${sysconfdir}/init.d
-        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/rsyslog
+        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog.${PN}
 }
 
-pkg_postinst() {
-        update-rc.d -f syslog remove
+pkg_preinst_${PN} () {
+    # this is needed to avoid sysmlink errors,
+    # because update-rc.d runs before pkg_postinst :(
+    touch {sysconfdir}/init.d/syslog
 }
 
-pkg_postrm() {
-        update-rc.d syslog add 5
+pkg_postinst_${PN} () {
+    update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 300
+}
+
+pkg_prerm_${PN} () {
+    update-alternatives --remove syslog-init syslog.${PN}
 }
 
 CONFFILES_${PN} = "${sysconfdir}/rsyslog.conf"
 
-INITSCRIPT_NAME = "rsyslog"
-#INITSCRIPT_PARAMS = "defaults 05"
-INITSCRIPT_PARAMS = "remove"
+INITSCRIPT_NAME = "syslog"
recipes/sysklogd/sysklogd.inc +15 -4
index 65da86d..f6b6aab 100644
@@ -1,16 +1,17 @@
 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 ."
+
+INITSCRIPT_NAME = "syslog"
+
 CFLAGS_append = " -DSYSV"
-RCONFLICTS = "busybox-syslog"
 
 do_install () {
 	install -d ${D}${mandir}/man8 \
@@ -23,14 +24,24 @@ 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} () {
+    # this is needed to avoid sysmlink errors,
+    # because update-rc.d runs before pkg_postinst :(
+    touch {sysconfdir}/init.d/syslog
 }
+
 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
 }
+
 pkg_prerm_${PN} () {
     update-alternatives --remove syslogd syslogd.${PN}
     update-alternatives --remove klogd klogd.${PN}
+    update-alternatives --remove syslog-init syslog.${PN}
 }
 
recipes/sysklogd/sysklogd_1.4.1.bb +1 -1
index 3d938f5..e02dd3e 100644
@@ -1,5 +1,5 @@
 require sysklogd.inc
-PR = "r1"
+PR = "${INC_PR}.1"
 
 
 SRC_URI[md5sum] = "d214aa40beabf7bdb0c9b3c64432c774"
recipes/sysklogd/sysklogd_1.5.bb +1 -1
index 70e55c3..a015768 100644
@@ -1,5 +1,5 @@
 require sysklogd.inc
-PR = "r2"
+PR = "${INC_PR}.2"
 
 SRC_URI += "file://no-strip-install.patch;patch=1"
 
Signature · 1 line
1.6.4.2
#9 lore raw

Re: [PATCH] busybox/syslogs: use update-alternatives for syslog selection

Quoted 35 lines · Steffen Sledz

* u-a for init scripts of busybox-syslog, sysklogd, and rsyslog
* syslog-ng needs to be integrated too!

---
 recipes/busybox/busybox.inc        |   18 ++++++++++++++++--
 recipes/rsyslog/rsyslog.inc        |   22 +++++++++++++---------
 recipes/sysklogd/sysklogd.inc      |   19 +++++++++++++++----
 recipes/sysklogd/sysklogd_1.4.1.bb |    2 +-
 recipes/sysklogd/sysklogd_1.5.bb   |    2 +-
 5 files changed, 46 insertions(+), 17 deletions(-)
recipes/busybox/busybox.inc +2 -2
index 17d8d14..31651d6 100644
@@ -11,7 +11,7 @@ LICENSE = "GPLv2"
 SECTION = "base"
 PRIORITY = "required"
 
-INC_PR = "r27"
+INC_PR = "r28"
 
 SRC_URI = "\
   file://busybox-cron \
@@ -46,7 +46,7 @@ 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"

recipes/busybox/busybox.inc pkg_prerm_${PN}-mountall () { · line 160

Quoted 7 lines
recipes/busybox/busybox.inc +4 -0
@@ -154,6 +154,20 @@ pkg_prerm_${PN}-mountall () {
 	update-alternatives --remove default_mountall mountall.${PN}
 }
 
+pkg_preinst_${PN}-syslog () {
+    # this is needed to avoid sysmlink errors,
+    # because update-rc.d runs before pkg_postinst :(
+    touch {sysconfdir}/init.d/syslog

missing $
touch: cannot touch `{sysconfdir}/init.d/syslog': No such file or directory

but even when I add $ here it should fail like
update-alternatives: Error: not linking //usr/bin/time to ../../bin/busybox since //usr/bin/time exists and is not a link

but fails a bit different

Configuring busybox-syslog.
update-rc.d: /etc/init.d/syslog: file does not exist
update-alternatives: Linking //etc/init.d/syslog to syslog.busybox

Removing package busybox-syslog from root...
update-alternatives: removing //etc/init.d/syslog as no more alternatives exist for it //usr/lib/opkg/info/busybox-syslog.prerm: line 6: /etc/init.d/syslog:
//not found

ie prerm has same problem as postinst.., genarated fuctions:
postinst
#!/bin/sh
if test "x$D" != "x"; then

        OPT="-r $D"
else
        OPT="-s"
fi
update-rc.d $OPT syslog defaults
    update-alternatives --install /etc/init.d/syslog syslog-init

syslog.busybox 50

postrm
#!/bin/sh
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

preinst

# this is needed to avoid sysmlink errors,
    # because update-rc.d runs before pkg_postinst :(
    touch /etc/init.d/syslog

prerm
update-alternatives --remove syslog-init syslog.busybox if test "x$D" = "x"; then

        if test "$1" = "upgrade" -o "$1" = "remove"; then
                /etc/init.d/syslog stop
        fi

fi

Quoted 65 lines
recipes/busybox/busybox.inc +10 -0
+}
+
+pkg_postinst_${PN}-syslog () {
+    update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 50
+}
+
+pkg_prerm_${PN}-syslog () {
+    update-alternatives --remove syslog-init syslog.${PN}
+}
+
 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
recipes/rsyslog/rsyslog.inc +13 -9
index 3e39ba0..6471724 100644
@@ -2,7 +2,7 @@ DESCRIPTION = "Rsyslog is an enhanced multi-threaded syslogd"
 DEPENDS = "zlib"
 HOMEPAGE = "http://www.rsyslog.com/"
 LICENSE = "GPLv3"
-INC_PR = "r0"
+INC_PR = "r1"
 
 SRC_URI = "http://download.rsyslog.com/rsyslog/${PN}-${PV}.tar.gz \
           file://rsyslog.conf \
@@ -14,19 +14,23 @@ do_install_append() {
         install -d ${D}/${sysconfdir}/${PN}
         install ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
         install -d ${D}/${sysconfdir}/init.d
-        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/rsyslog
+        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog.${PN}
 }
 
-pkg_postinst() {
-        update-rc.d -f syslog remove
+pkg_preinst_${PN} () {
+    # this is needed to avoid sysmlink errors,
+    # because update-rc.d runs before pkg_postinst :(
+    touch {sysconfdir}/init.d/syslog
 }
 
-pkg_postrm() {
-        update-rc.d syslog add 5
+pkg_postinst_${PN} () {
+    update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 300
+}
+
+pkg_prerm_${PN} () {
+    update-alternatives --remove syslog-init syslog.${PN}
 }
 
 CONFFILES_${PN} = "${sysconfdir}/rsyslog.conf"
 
-INITSCRIPT_NAME = "rsyslog"
-#INITSCRIPT_PARAMS = "defaults 05"
-INITSCRIPT_PARAMS = "remove"
+INITSCRIPT_NAME = "syslog"
recipes/sysklogd/sysklogd.inc +0 -0
index 65da86d..f6b6aab 100644
@@ -1,16 +1,17 @@
 LICENSE = "GPL"
 SECTION = "base"

recipes/sysklogd/sysklogd.inc line 11

Quoted 10 lines
recipes/sysklogd/sysklogd.inc +1 -2
 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 ."

params not needed anymore?

recipes/sysklogd/sysklogd.inc line 13

Quoted 5 lines
recipes/sysklogd/sysklogd.inc +3 -1
+
+INITSCRIPT_NAME = "syslog"
+
 CFLAGS_append = " -DSYSV"
-RCONFLICTS = "busybox-syslog"

Regards,

#15 lore raw
In reply to Steffen Sledz
Quoted 15 lines · Steffen Sledz
Quoted 9 lines
Quoted 3 lines

Would be a

touch {sysconfdir}/init.d/syslog

:) also option, but u-a should at least show warning that link file is not and link and in worse scenario refuse to replace non-link file with link to alternative (IIRC the case for u-a-cworth and his variant included in opkg).

Quoted 5 lines

What I had in mind was adding:
update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS} after u-a call in postinst and similar update-rc.d $OPT ${INITSCRIPT_NAME} remove
in postrm, etc.

Quoted 4 lines

I would prefer my method because the update-rc.d class does a bit more than just calling update-rc.d (e.g. stop running services). And i thing it's not a good idea to duplicate the whole code.

I don't like duplicate code too, but maybe you don't need to restart syslog? And your version doesn't work for u-a from opkg and u-a-cworth as described in reply to that patch.

Quoted 1 line

Regards,

Regards,

Quoted 1 line

Steffen

Signature · 3 lines
uin:136542059                jid:[email protected]
Jansa Martin                 sip:[email protected] 
JaMa                         
#12 lore raw

Re: [PATCH] busybox/syslogs: use update-alternatives for syslog selection

In reply to Steffen Sledz
Quoted 45 lines · Steffen Sledz

* u-a for init scripts of busybox-syslog, sysklogd, and rsyslog
* syslog-ng needs to be integrated too!

---
 recipes/busybox/busybox.inc        |   18 ++++++++++++++++--
 recipes/rsyslog/rsyslog.inc        |   22 +++++++++++++---------
 recipes/sysklogd/sysklogd.inc      |   19 +++++++++++++++----
 recipes/sysklogd/sysklogd_1.4.1.bb |    2 +-
 recipes/sysklogd/sysklogd_1.5.bb   |    2 +-
 5 files changed, 46 insertions(+), 17 deletions(-)
recipes/busybox/busybox.inc +9 -2
index 17d8d14..31651d6 100644
@@ -11,7 +11,7 @@ LICENSE = "GPLv2"
 SECTION = "base"
 PRIORITY = "required"
 
-INC_PR = "r27"
+INC_PR = "r28"
 
 SRC_URI = "\
   file://busybox-cron \
@@ -46,7 +46,7 @@ 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"
@@ -154,6 +154,20 @@ pkg_prerm_${PN}-mountall () {
 	update-alternatives --remove default_mountall mountall.${PN}
 }
 
+pkg_preinst_${PN}-syslog () {
+    # this is needed to avoid sysmlink errors,
+    # because update-rc.d runs before pkg_postinst :(
+    touch {sysconfdir}/init.d/syslog
+}
+
+pkg_postinst_${PN}-syslog () {

recipes/busybox/busybox.inc pkg_prerm_${PN}-mountall () { · line 173

Quoted 10 lines
recipes/busybox/busybox.inc +7 -0
+    update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 50
+}
+
+pkg_prerm_${PN}-syslog () {
+    update-alternatives --remove syslog-init syslog.${PN}
+}
+
 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

One more issue with this part, partialy explaining what went wrong in that log. You're not creating syslog.busybox, so real /etc/init.d/syslog is not packaged and after u-a /etc/init.d/syslog points to non-existing /etc/init.d/syslog.busybox and that's why update-rc.d says it doesn't exist.

Regards,

#10 lore raw

Re: [PATCH] busybox/syslogs: use update-alternatives for syslog selection

In reply to Martin Jansa
Quoted 6 lines · Martin Jansa

recipes/busybox/busybox.inc pkg_prerm_${PN}-mountall () { · line 160

Quoted 4 lines
recipes/busybox/busybox.inc +4 -0
+pkg_preinst_${PN}-syslog () {
+    # this is needed to avoid sysmlink errors,
+    # because update-rc.d runs before pkg_postinst :(
+    touch {sysconfdir}/init.d/syslog

missing $

<Grrrr>

Quoted 10 lines

touch: cannot touch `{sysconfdir}/init.d/syslog': No such file or directory

but even when I add $ here it should fail like
update-alternatives: Error: not linking //usr/bin/time to ../../bin/busybox since //usr/bin/time exists and is not a link

but fails a bit different

Configuring busybox-syslog.
update-rc.d: /etc/init.d/syslog: file does not exist
update-alternatives: Linking //etc/init.d/syslog to syslog.busybox

Are you sure that you run the patched version? It looks like running a version without touch in pkg_preinst.

Quoted 5 lines

...

recipes/sysklogd/sysklogd.inc line 11

Quoted 2 lines
recipes/sysklogd/sysklogd.inc +0 -2
-INITSCRIPT_NAME = "sysklogd"
-INITSCRIPT_PARAMS = "start 39 S 1 2 3 . stop 99 0 6 ."

params not needed anymore?

Fall back to the defaults like in all the other syslog recipes.

Regards,
Steffen

#13 lore raw

Re: [PATCH] busybox/syslogs: use update-alternatives for syslog selection

In reply to Martin Jansa
Quoted 5 lines · Martin Jansa

One more issue with this part, partialy explaining what went wrong in that log. You're not creating syslog.busybox, so real /etc/init.d/syslog is not packaged and after u-a /etc/init.d/syslog points to non-existing /etc/init.d/syslog.busybox and that's why update-rc.d says it doesn't exist.

Forgot a little modification in do_install. Will be fixed in the next patch version.

Thanx,
Steffen

#14 lore raw

PATCH v2 1/1 busybox/syslogs: use update-alternatives for syslog selection

In reply to Steffen Sledz

* u-a for init scripts of busybox-syslog, sysklogd, and rsyslog
* syslog-ng needs to be integrated too!

---
 recipes/busybox/busybox.inc        |   20 +++++++++++++++++---
 recipes/rsyslog/rsyslog.inc        |   22 +++++++++++++---------
 recipes/sysklogd/sysklogd.inc      |   19 +++++++++++++++----
 recipes/sysklogd/sysklogd_1.4.1.bb |    2 +-
 recipes/sysklogd/sysklogd_1.5.bb   |    2 +-
 5 files changed, 47 insertions(+), 18 deletions(-)
recipes/busybox/busybox.inc +17 -3
index 17d8d14..33b3811 100644
@@ -11,7 +11,7 @@ LICENSE = "GPLv2"
 SECTION = "base"
 PRIORITY = "required"
 
-INC_PR = "r27"
+INC_PR = "r28"
 
 SRC_URI = "\
   file://busybox-cron \
@@ -46,7 +46,7 @@ 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"
@@ -104,7 +104,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
@@ -154,6 +154,20 @@ pkg_prerm_${PN}-mountall () {
 	update-alternatives --remove default_mountall mountall.${PN}
 }
 
+pkg_preinst_${PN}-syslog () {
+    # this is needed to avoid sysmlink errors,
+    # because update-rc.d runs before pkg_postinst :(
+    touch ${sysconfdir}/init.d/syslog
+}
+
+pkg_postinst_${PN}-syslog () {
+    update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 50
+}
+
+pkg_prerm_${PN}-syslog () {
+    update-alternatives --remove syslog-init syslog.${PN}
+}
+
 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
recipes/rsyslog/rsyslog.inc +13 -9
index 3e39ba0..d7b81c0 100644
@@ -2,7 +2,7 @@ DESCRIPTION = "Rsyslog is an enhanced multi-threaded syslogd"
 DEPENDS = "zlib"
 HOMEPAGE = "http://www.rsyslog.com/"
 LICENSE = "GPLv3"
-INC_PR = "r0"
+INC_PR = "r1"
 
 SRC_URI = "http://download.rsyslog.com/rsyslog/${PN}-${PV}.tar.gz \
           file://rsyslog.conf \
@@ -14,19 +14,23 @@ do_install_append() {
         install -d ${D}/${sysconfdir}/${PN}
         install ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
         install -d ${D}/${sysconfdir}/init.d
-        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/rsyslog
+        install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog.${PN}
 }
 
-pkg_postinst() {
-        update-rc.d -f syslog remove
+pkg_preinst_${PN} () {
+    # this is needed to avoid sysmlink errors,
+    # because update-rc.d runs before pkg_postinst :(
+    touch ${sysconfdir}/init.d/syslog
 }
 
-pkg_postrm() {
-        update-rc.d syslog add 5
+pkg_postinst_${PN} () {
+    update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 300
+}
+
+pkg_prerm_${PN} () {
+    update-alternatives --remove syslog-init syslog.${PN}
 }
 
 CONFFILES_${PN} = "${sysconfdir}/rsyslog.conf"
 
-INITSCRIPT_NAME = "rsyslog"
-#INITSCRIPT_PARAMS = "defaults 05"
-INITSCRIPT_PARAMS = "remove"
+INITSCRIPT_NAME = "syslog"
recipes/sysklogd/sysklogd.inc +15 -4
index 65da86d..8720e09 100644
@@ -1,16 +1,17 @@
 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 ."
+
+INITSCRIPT_NAME = "syslog"
+
 CFLAGS_append = " -DSYSV"
-RCONFLICTS = "busybox-syslog"
 
 do_install () {
 	install -d ${D}${mandir}/man8 \
@@ -23,14 +24,24 @@ 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} () {
+    # this is needed to avoid sysmlink errors,
+    # because update-rc.d runs before pkg_postinst :(
+    touch ${sysconfdir}/init.d/syslog
 }
+
 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
 }
+
 pkg_prerm_${PN} () {
     update-alternatives --remove syslogd syslogd.${PN}
     update-alternatives --remove klogd klogd.${PN}
+    update-alternatives --remove syslog-init syslog.${PN}
 }
 
recipes/sysklogd/sysklogd_1.4.1.bb +1 -1
index 3d938f5..e02dd3e 100644
@@ -1,5 +1,5 @@
 require sysklogd.inc
-PR = "r1"
+PR = "${INC_PR}.1"
 
 
 SRC_URI[md5sum] = "d214aa40beabf7bdb0c9b3c64432c774"
recipes/sysklogd/sysklogd_1.5.bb +1 -1
index 70e55c3..a015768 100644
@@ -1,5 +1,5 @@
 require sysklogd.inc
-PR = "r2"
+PR = "${INC_PR}.2"
 
 SRC_URI += "file://no-strip-install.patch;patch=1"
 
Signature · 1 line
1.6.4.2
#11 lore raw

Re: [PATCH] busybox/syslogs: use update-alternatives for syslog selection

In reply to Steffen Sledz
Quoted 6 lines · Steffen Sledz
Quoted 3 lines

Configuring busybox-syslog.
update-rc.d: /etc/init.d/syslog: file does not exist
update-alternatives: Linking //etc/init.d/syslog to syslog.busybox

Are you sure that you run the patched version? It looks like running a version without touch in pkg_preinst.

Yes I'm sure.

Both reported problems are the same with PATCHv2.
Not sure why now I see also Permission denied (but maybe it was the same with PATCHv1).

SHR root@gojama ~ $ opkg remove busybox-syslog
Removing package busybox-syslog from root...
update-alternatives: removing //etc/init.d/syslog as no more alternatives exist for it //usr/lib/opkg/info/busybox-syslog.prerm: line 6: /etc/init.d/syslog: Permission denied
Collected errors:
* pkg_run_script: prerm script returned status 126.
SHR root@gojama ~ $ opkg install busybox-syslog
Installing busybox-syslog (1.15.3-r28.1.4) to root...
Downloading http://jama.homelinux.org/org.openembedded.shr/armv4t/busybox-syslog_1.15.3-r28.1.4_armv4t.ipk.
Configuring busybox-syslog.
System startup links for /etc/init.d/syslog already exist.
/usr/sbin/update-rc.d: line 237: /etc/rc5.d/S20syslog: Permission denied
update-alternatives: Error: not linking //etc/init.d/syslog to syslog.busybox since //etc/init.d/syslog exists and is not a link Collected errors:
* pkg_run_script: postinst script returned status 1.
* opkg_configure: busybox-syslog.postinst returned 1.

Quoted 8 lines
Quoted 6 lines

...

recipes/sysklogd/sysklogd.inc line 11

Quoted 2 lines
recipes/sysklogd/sysklogd.inc +0 -2
-INITSCRIPT_NAME = "sysklogd"
-INITSCRIPT_PARAMS = "start 39 S 1 2 3 . stop 99 0 6 ."

params not needed anymore?

Fall back to the defaults like in all the other syslog recipes.

OK.

Signature · 3 lines
uin:136542059                jid:[email protected]
Jansa Martin                 sip:[email protected] 
JaMa                         
#16 lore raw

PATCH v3 1/1 busybox/syslogs: use update-alternatives for syslog selection

In reply to Martin Jansa

* u-a for init scripts of busybox-syslog, sysklogd, and rsyslog
* syslog-ng needs to be integrated too!

---
 recipes/busybox/busybox.inc        |   44 +++++++++++++++++++++++++++---
 recipes/rsyslog/rsyslog.inc        |   48 ++++++++++++++++++++++++++-------
 recipes/sysklogd/sysklogd.inc      |   52 ++++++++++++++++++++++++++++++++---
 recipes/sysklogd/sysklogd_1.4.1.bb |    2 +-
 recipes/sysklogd/sysklogd_1.5.bb   |    2 +-
 5 files changed, 127 insertions(+), 21 deletions(-)
recipes/busybox/busybox.inc +40 -4
index 17d8d14..7c170fb 100644
@@ -11,7 +11,7 @@ LICENSE = "GPLv2"
 SECTION = "base"
 PRIORITY = "required"
 
-INC_PR = "r27"
+INC_PR = "r28"
 
 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"
@@ -104,7 +106,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
@@ -154,6 +156,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
recipes/rsyslog/rsyslog.inc +38 -10

69 lines not on this page · raw message

recipes/sysklogd/sysklogd.inc +47 -5

77 lines not on this page · raw message

recipes/sysklogd/sysklogd_1.4.1.bb +1 -1
index 3d938f5..e02dd3e 100644
@@ -1,5 +1,5 @@
 require sysklogd.inc
-PR = "r1"
+PR = "${INC_PR}.1"
 
 
 SRC_URI[md5sum] = "d214aa40beabf7bdb0c9b3c64432c774"
recipes/sysklogd/sysklogd_1.5.bb +1 -1
index 70e55c3..a015768 100644
@@ -1,5 +1,5 @@
 require sysklogd.inc
-PR = "r2"
+PR = "${INC_PR}.2"
 
 SRC_URI += "file://no-strip-install.patch;patch=1"
 
Signature · 1 line
1.6.4.2
#17 lore raw

Re: [PATCH v3] busybox/syslogs: use update-alternatives for syslog selection

Quoted 2 lines · Steffen Sledz

* u-a for init scripts of busybox-syslog, sysklogd, and rsyslog
* syslog-ng needs to be integrated too!

Thanks, looks better now.

recipes/rsyslog/rsyslog.inc DESCRIPTION = "Rsyslog is an enhanced multi-threaded syslogd" · line 12

Quoted 3 lines
recipes/rsyslog/rsyslog.inc +2 -1
-inherit autotools update-rc.d
+
+inherit autotools

then you probably needs to add:
DEPENDS_append = " update-rc.d update-rc.d-native"
RDEPENDS_${PN}_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}"

recipes/sysklogd/sysklogd.inc line 9

Quoted 2 lines
recipes/sysklogd/sysklogd.inc +0 -1
-inherit update-rc.d

The same as above.

Regards,

Signature · 3 lines
uin:136542059                jid:[email protected]
Jansa Martin                 sip:[email protected] 
JaMa                         
#18 lore raw

PATCH v4 1/1 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!

---
 recipes/busybox/busybox.inc        |   44 ++++++++++++++++++++++++++--
 recipes/rsyslog/rsyslog.inc        |   50 ++++++++++++++++++++++++++------
 recipes/sysklogd/sysklogd.inc      |   55 ++++++++++++++++++++++++++++++++---
 recipes/sysklogd/sysklogd_1.4.1.bb |    2 +-
 recipes/sysklogd/sysklogd_1.5.bb   |    2 +-
 5 files changed, 132 insertions(+), 21 deletions(-)
recipes/busybox/busybox.inc +40 -4
index 17d8d14..7c170fb 100644
@@ -11,7 +11,7 @@ LICENSE = "GPLv2"
 SECTION = "base"
 PRIORITY = "required"
 
-INC_PR = "r27"
+INC_PR = "r28"
 
 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"
@@ -104,7 +106,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
@@ -154,6 +156,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
recipes/rsyslog/rsyslog.inc +40 -10

71 lines not on this page · raw message

recipes/sysklogd/sysklogd.inc +50 -5

80 lines not on this page · raw message

recipes/sysklogd/sysklogd_1.4.1.bb +1 -1
index 3d938f5..e02dd3e 100644
@@ -1,5 +1,5 @@
 require sysklogd.inc
-PR = "r1"
+PR = "${INC_PR}.1"
 
 
 SRC_URI[md5sum] = "d214aa40beabf7bdb0c9b3c64432c774"
recipes/sysklogd/sysklogd_1.5.bb +1 -1
index 70e55c3..a015768 100644
@@ -1,5 +1,5 @@
 require sysklogd.inc
-PR = "r2"
+PR = "${INC_PR}.2"
 
 SRC_URI += "file://no-strip-install.patch;patch=1"
 
Signature · 1 line
1.6.4.2
#19 lore raw

Re: [PATCH v4] busybox/syslogs: use update-alternatives for syslog selection

Some ACKs for this patch?

Regards,
Steffen

Acked-by on v4 1/1
#20 lore raw

Re: [PATCH v4] busybox/syslogs: use update-alternatives for syslog selection

In reply to Steffen Sledz
Quoted 4 lines · Steffen Sledz

* u-a for init scripts of busybox-syslog, sysklogd, and rsyslog
* syslog-ng needs to be integrated too!

This version seems OK to me, tested with busybox-syslog. (Needs INC_PR increase in busybox.inc to rebase on HEAD).

Signature · 3 lines
uin:136542059                jid:[email protected]
Jansa Martin                 sip:[email protected] 
JaMa