Skip to contentSkip to conversation

Don't use update-alternatives for syslog init script

PATCH New Markus Lehtonen 1 participant 3 messages Nov 21, 2016

lore
Share & tools
lore
#0 lore raw

cover Don't use update-alternatives for syslog init script

This is a follow-up for an earlier similar patchset for oe-core.

This patchset makes syslog packages conflict each other instead of using update-alternatives to manage their init script. Using update-alternatives for init scripts seems to cause unfixable problems in oe, and, there should be no need to install two syslog services in the system at the same time (one of which would be inactive anyway).

[YOCTO #10433]

Markus Lehtonen (2):
syslog-ng: don't use update-alternatives to manage init script
rsyslog: don't use update-alternatives to manage init script

 meta-oe/recipes-extended/rsyslog/rsyslog_8.22.0.bb | 34 +++-------------------
 meta-oe/recipes-support/syslog-ng/syslog-ng.inc    | 22 +++-----------
 2 files changed, 8 insertions(+), 48 deletions(-)
Signature · 1 line
2.6.6
#1 lore raw

PATCH 1/2 syslog-ng: don't use update-alternatives to manage init script

Also, explicitly conflict with other syslog providers.

[YOCTO #10433]

---
 meta-oe/recipes-support/syslog-ng/syslog-ng.inc | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)
meta-oe/recipes-support/syslog-ng/syslog-ng.inc +4 -18
index 898e9c2..0acdd73 100644
@@ -22,7 +22,7 @@ SRC_URI = "http://www.balabit.com/downloads/files/syslog-ng/sources/${PV}/source
            file://configure.ac-add-option-enable-thread-tls-to-manage-.patch \
 "
 
-inherit autotools systemd pkgconfig update-alternatives update-rc.d
+inherit autotools systemd pkgconfig update-rc.d
 
 EXTRA_OECONF = " \
     --enable-dynamic-linking \
@@ -70,7 +70,7 @@ do_install_append() {
     install -d ${D}/${sysconfdir}/${BPN}
     install ${WORKDIR}/syslog-ng.conf ${D}${sysconfdir}/${BPN}/${BPN}.conf
     install -d ${D}/${sysconfdir}/init.d
-    install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog.${BPN}
+    install -m 755 ${WORKDIR}/initscript ${D}/${sysconfdir}/init.d/syslog
     install -d ${D}/${sysconfdir}/default/volatiles/
     install -m 755 ${WORKDIR}/volatiles.03_syslog-ng ${D}/${sysconfdir}/default/volatiles/03_syslog-ng
     install -d ${D}/${localstatedir}/lib/${BPN}
@@ -96,26 +96,12 @@ CONFFILES_${PN} = "${sysconfdir}/${BPN}.conf ${sysconfdir}/scl.conf"
 # update-rc.d and update-alternatives is important
 RDEPENDS_${PN} += " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}"
 
+RCONFLICTS_${PN} = "busybox-syslog sysklogd rsyslog"
+
 RPROVIDES_${PN} += "${PN}-systemd"
 RREPLACES_${PN} += "${PN}-systemd"
 RCONFLICTS_${PN} += "${PN}-systemd"
 SYSTEMD_SERVICE_${PN} = "${BPN}.service"
 
-# no syslog-init for systemd
-python () {
-    if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
-        pn = d.getVar('PN', True)
-        sysconfdir = d.getVar('sysconfdir', True)
-        d.appendVar('ALTERNATIVE_%s' % (pn), ' syslog-init')
-        d.setVarFlag('ALTERNATIVE_PRIORITY', 'syslog-init', '200')
-        d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-init', '%s/init.d/syslog' % (sysconfdir))
-
-    if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
-        pn = d.getVar('PN', True)
-        d.appendVar('ALTERNATIVE_%s' % (pn), ' syslog-service')
-        d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-service', '%s/systemd/system/syslog.service' % (d.getVar('sysconfdir', True)))
-        d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-service', '%s/system/${BPN}.service' % (d.getVar('systemd_unitdir', True)))
-}
-
 INITSCRIPT_NAME = "syslog"
 INITSCRIPT_PARAMS = "start 20 2 3 4 5 . stop 90 0 1 6 ."
Signature · 1 line
2.6.6
#2 lore raw

PATCH 2/2 rsyslog: don't use update-alternatives to manage init script

In reply to Markus Lehtonen

Also, explicitly conflict with other syslog providers.

[YOCTO #10433]

---
 meta-oe/recipes-extended/rsyslog/rsyslog_8.22.0.bb | 34 +++-------------------
 1 file changed, 4 insertions(+), 30 deletions(-)
meta-oe/recipes-extended/rsyslog/rsyslog_8.22.0.bb +4 -30
index 7242323..c0e0a6d 100644
@@ -29,7 +29,7 @@ SRC_URI = "http://www.rsyslog.com/download/files/download/rsyslog/${BPN}-${PV}.t
 SRC_URI[md5sum] = "ad0f25f429aa2daa326732950a5eeb6c"
 SRC_URI[sha256sum] = "06e2884181333dccecceaca82827ae24ca7a258b4fbf7b1e07a80d4caae640ca"
 
-inherit autotools pkgconfig systemd update-rc.d update-alternatives ptest
+inherit autotools pkgconfig systemd update-rc.d ptest
 
 EXTRA_OECONF += "--disable-generate-man-pages"
 
@@ -114,7 +114,7 @@ do_install_ptest() {
 
 do_install_append() {
     install -d "${D}${sysconfdir}/init.d"
-    install -m 755 ${WORKDIR}/initscript ${D}${sysconfdir}/init.d/syslog.${BPN}
+    install -m 755 ${WORKDIR}/initscript ${D}${sysconfdir}/init.d/syslog
     install -m 644 ${WORKDIR}/rsyslog.conf ${D}${sysconfdir}/rsyslog.conf
     install -m 644 ${WORKDIR}/rsyslog.logrotate ${D}${sysconfdir}/logrotate.rsyslog
 }
@@ -124,20 +124,10 @@ FILES_${PN} += "${bindir}"
 INITSCRIPT_NAME = "syslog"
 INITSCRIPT_PARAMS = "defaults"
 
-# higher than sysklogd's 100
-ALTERNATIVE_PRIORITY = "110"
-
-ALTERNATIVE_${PN} = "syslogd syslog-conf syslog-logrotate"
-
-ALTERNATIVE_LINK_NAME[syslogd] = "${base_sbindir}/syslogd"
-ALTERNATIVE_TARGET[syslogd] = "${sbindir}/rsyslogd"
-ALTERNATIVE_LINK_NAME[syslog-conf] = "${sysconfdir}/syslog.conf"
-ALTERNATIVE_TARGET[syslog-conf] = "${sysconfdir}/rsyslog.conf"
-ALTERNATIVE_LINK_NAME[syslog-logrotate] = "${sysconfdir}/logrotate.d/syslog"
-ALTERNATIVE_TARGET[syslog-logrotate] = "${sysconfdir}/logrotate.rsyslog"
-
 CONFFILES_${PN} = "${sysconfdir}/rsyslog.conf"
 
+RCONFLICTS_${PN} = "busybox-syslog sysklogd syslog-ng"
+
 RPROVIDES_${PN} += "${PN}-systemd"
 RREPLACES_${PN} += "${PN}-systemd"
 RCONFLICTS_${PN} += "${PN}-systemd"
@@ -154,19 +144,3 @@ VALGRIND_arm = ""
 VALGRIND_aarch64 = ""
 RDEPENDS_${PN}-ptest += "make diffutils gzip bash gawk coreutils procps"
 RRECOMMENDS_${PN}-ptest += "${TCLIBC}-dbg ${VALGRIND}"
-
-# no syslog-init for systemd
-python () {
-    if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
-        pn = d.getVar('PN', True)
-        sysconfdir = d.getVar('sysconfdir', True)
-        d.appendVar('ALTERNATIVE_%s' % (pn), ' syslog-init')
-        d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-init', '%s/init.d/syslog' % (sysconfdir))
-        d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-init', '%s/init.d/syslog.%s' % (d.getVar('sysconfdir', True), d.getVar('BPN', True)))
-
-    if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d):
-        pn = d.getVar('PN', True)
-        d.appendVar('ALTERNATIVE_%s' % (pn), ' syslog-service')
-        d.setVarFlag('ALTERNATIVE_LINK_NAME', 'syslog-service', '%s/systemd/system/syslog.service' % (d.getVar('sysconfdir', True)))
-        d.setVarFlag('ALTERNATIVE_TARGET', 'syslog-service', '%s/system/rsyslog.service' % (d.getVar('systemd_unitdir', True)))
-}
Signature · 1 line
2.6.6