Skip to contentSkip to conversation

corosync: Clean up leftover support for qdevice and qnetd

PATCH New Peter Kjellerstedt 1 participant 8 messages Nov 2, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 corosync: Clean up leftover support for qdevice and qnetd

These features were removed in commit 5c051f84 (corosync: Update to 3.0.3), but some code still remained.

---
 .../corosync/corosync_3.0.3.bb                 | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
meta-networking/recipes-extended/corosync/corosync_3.0.3.bb +3 -15
index 909296197..016441be5 100644
@@ -5,7 +5,7 @@ HOMEPAGE = "http://corosync.github.io/corosync/"
 
 SECTION = "base"
 
-inherit autotools pkgconfig systemd useradd
+inherit autotools pkgconfig systemd
 
 SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BP}.tar.gz \
            file://corosync.conf \
@@ -18,10 +18,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=a85eb4ce24033adb6088dd1d6ffc5e5d"
 
 DEPENDS = "groff-native nss libqb kronosnet"
 
-SYSTEMD_SERVICE:${PN} = "corosync.service corosync-notifyd.service \
-                         ${@bb.utils.contains('PACKAGECONFIG', 'qdevice', 'corosync-qdevice.service', '', d)} \
-                         ${@bb.utils.contains('PACKAGECONFIG', 'qnetd', 'corosync-qnetd.service', '', d)} \
-"
+SYSTEMD_SERVICE:${PN} = "corosync.service corosync-notifyd.service"
 SYSTEMD_AUTO_ENABLE = "disable"
 
 INITSCRIPT_NAME = "corosync-daemon"
@@ -43,7 +40,7 @@ EXTRA_OEMAKE = "tmpfilesdir_DATA="
 #}
 
 do_install:append() {
-    install -D -m 0644 ${WORKDIR}/corosync.conf ${D}/${sysconfdir}/corosync/corosync.conf.example
+    install -D -m 0644 ${WORKDIR}/corosync.conf ${D}${sysconfdir}/corosync/corosync.conf.example
     install -d ${D}${sysconfdir}/sysconfig/
     install -m 0644 ${S}/init/corosync.sysconfig.example ${D}${sysconfdir}/sysconfig/corosync
     install -m 0644 ${S}/tools/corosync-notifyd.sysconfig.example ${D}${sysconfdir}/sysconfig/corosync-notifyd
@@ -53,11 +50,6 @@ do_install:append() {
     install -d ${D}${sysconfdir}/default/volatiles
     echo "d root root 0755 ${localstatedir}/log/cluster none" > ${D}${sysconfdir}/default/volatiles/05_corosync
 
-    if [ ${@bb.utils.filter('PACKAGECONFIG', 'qnetd', d)} ]; then
-        chown -R coroqnetd:coroqnetd ${D}${sysconfdir}/${BPN}/qnetd
-        echo "d coroqnetd coroqnetd 0770 /var/run/corosync-qnetd none" >> ${D}${sysconfdir}/default/volatiles/05_corosync
-    fi
-
     if [ ${@bb.utils.filter('DISTRO_FEATURES','systemd',d)} ]; then
         install -d ${D}${sysconfdir}/tmpfiles.d
         echo "d ${localstatedir}/log/cluster - - - -" > ${D}${sysconfdir}/tmpfiles.d/corosync.conf
@@ -68,7 +60,3 @@ RDEPENDS:${PN} += "bash ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sys
 
 FILES:${PN}-dbg += "${libexecdir}/lcrso/.debug"
 FILES:${PN}-doc += "${datadir}/snmp/mibs/COROSYNC-MIB.txt"
-
-USERADD_PACKAGES = "${PN}"
-GROUPADD_PARAM:${PN} = "--system coroqnetd"
-USERADD_PARAM:${PN} = "--system -d / -M -s /bin/nologin -c 'User for corosync-qnetd' -g coroqnetd coroqnetd"
#1 lore raw

PATCH 2/8 corosync: Do not install the /var/log/cluster directory

/var/log is normally a link to /var/volatile/log and /var/volatile is a tmpfs mount. So anything created in /var/log will not be available when the tmpfs is mounted.

/var/log/cluster will be created in runtime.

This also drops the removal of the /var/run directory as it is no longer created in the first place.

---
 meta-networking/recipes-extended/corosync/corosync_3.0.3.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta-networking/recipes-extended/corosync/corosync_3.0.3.bb +2 -1
index 016441be5..ec2a78527 100644
@@ -45,7 +45,8 @@ do_install:append() {
     install -m 0644 ${S}/init/corosync.sysconfig.example ${D}${sysconfdir}/sysconfig/corosync
     install -m 0644 ${S}/tools/corosync-notifyd.sysconfig.example ${D}${sysconfdir}/sysconfig/corosync-notifyd
 
-    rm -rf "${D}${localstatedir}/run"
+    rmdir ${D}${localstatedir}/log/cluster ${D}${localstatedir}/log
+    rmdir --ignore-fail-on-non-empty ${D}${localstatedir}
 
     install -d ${D}${sysconfdir}/default/volatiles
     echo "d root root 0755 ${localstatedir}/log/cluster none" > ${D}${sysconfdir}/default/volatiles/05_corosync
#2 lore raw

PATCH 3/8 collectd: Do not install /var/log

In reply to Peter Kjellerstedt

Previously it installed an empty /var/log without anything in it.

---
 meta-oe/recipes-extended/collectd/collectd_5.12.0.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta-oe/recipes-extended/collectd/collectd_5.12.0.bb +2 -2
index b443afdb1..1c613b097 100644
@@ -70,8 +70,8 @@ do_install:append() {
     # Fix configuration file to allow collectd to start up
     sed -i 's!^#FQDNLookup[ \t]*true!FQDNLookup   false!g' ${D}${sysconfdir}/collectd.conf
 
-    rmdir "${D}${localstatedir}/run"
-    rmdir --ignore-fail-on-non-empty "${D}${localstatedir}"
+    rmdir ${D}${localstatedir}/run ${D}${localstatedir}/log
+    rmdir --ignore-fail-on-non-empty ${D}${localstatedir}
 
     # Install systemd unit files
     install -d ${D}${systemd_unitdir}/system
#3 lore raw

PATCH 4/8 atop: Do not install the /var/log/atop directory

In reply to Peter Kjellerstedt

/var/log is normally a link to /var/volatile/log and /var/volatile is a tmpfs mount. So anything created in /var/log will not be available when the tmpfs is mounted.

/var/log/atop will be created in runtime.

---
 meta-oe/recipes-support/atop/atop_2.4.0.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta-oe/recipes-support/atop/atop_2.4.0.bb +4 -0
index c91d86610..819303c57 100644
@@ -42,6 +42,10 @@ do_install() {
         rm -f ${D}${sysconfdir}/init.d/atopacct
     fi
 
+    # /var/log/atop will be created in runtime
+    rm -rf ${D}${localstatedir}/log
+    rmdir --ignore-fail-on-non-empty ${D}${localstatedir}
+
     # remove atopacct related files
     rm -rf ${D}${sbindir} ${D}${mandir}/man8
 }
#4 lore raw

PATCH 5/8 openflow: Create /var/log/openflow in runtime

In reply to Peter Kjellerstedt

/var/log is normally a link to /var/volatile/log and /var/volatile is a tmpfs mount. So anything created in /var/log will not be available when the tmpfs is mounted.

---
 .../recipes-protocols/openflow/openflow.inc    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
meta-networking/recipes-protocols/openflow/openflow.inc +18 -0
index 94d9553e1..c4e69b58e 100644
@@ -34,4 +34,22 @@ do_configure:prepend() {
 do_install:append() {
     # Remove /var/run as it is created on startup
     rm -rf ${D}${localstatedir}/run
+
+    # /var/log/openflow needs to be created in runtime. Use rmdir to catch if
+    # upstream stops creating /var/log/openflow, or adds something else in
+    # /var/log.
+    rmdir ${D}${localstatedir}/log/${BPN} ${D}${localstatedir}/log
+    rmdir --ignore-fail-on-non-empty ${D}${localstatedir}
+
+    # Create /var/log/openflow in runtime.
+    if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then
+        install -d ${D}${nonarch_libdir}/tmpfiles.d
+        echo "d ${localstatedir}/log/${BPN} - - - -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
+    fi
+    if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then
+        install -d ${D}${sysconfdir}/default/volatiles
+        echo "d root root 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN}
+    fi
 }
+
+FILES:${PN} += "${nonarch_libdir}/tmpfiles.d"
#5 lore raw

PATCH 6/8 mongodb: A little clean up

In reply to Peter Kjellerstedt

This cleans up whitespace, and avoids using ${...} for shell variables.

---
 .../recipes-dbs/mongodb/mongodb_git.bb        | 57 +++++++++----------
 1 file changed, 26 insertions(+), 31 deletions(-)
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +26 -31
index eff014a4c..461a1d007 100644
@@ -43,7 +43,6 @@ SRC_URI:append:toolchain-clang = "\
            file://0001-asio-Dont-use-experimental-with-clang.patch \
            "
 
-
 S = "${WORKDIR}/git"
 
 COMPATIBLE_HOST ?= '(x86_64|i.86|powerpc64|arm|aarch64).*-linux'
@@ -83,44 +82,40 @@ EXTRA_OESCONS = "PREFIX=${prefix} \
                  --separate-debug \
                  ${PACKAGECONFIG_CONFARGS}"
 
-
 USERADD_PACKAGES = "${PN}"
 USERADD_PARAM:${PN} = "--system --no-create-home --home-dir /var/run/${BPN} --shell /bin/false --user-group ${BPN}"
 
-
 scons_do_compile() {
-        ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core || \
+    ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} install-core ||
         die "scons build execution failed."
 }
 
 scons_do_install() {
-        # install binaries
-        install -d ${D}${bindir}
-        for i in mongod mongos mongo
-        do
-            if [ -f ${B}/build/opt/mongo/${i} ]
-            then
-                install -m 0755 ${B}/build/opt/mongo/${i} ${D}${bindir}/${i}
-            else
-                bbnote "${i} does not exist"
-            fi
-        done
-
-        # install config
-        install -d ${D}${sysconfdir}
-        install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir}/
-
-        # install systemd service
-        install -d ${D}${systemd_system_unitdir}
-        install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir}
-
-        # install mongo data folder
-        install -m 755 -d ${D}${localstatedir}/lib/${BPN}
-        chown ${PN}:${PN} ${D}${localstatedir}/lib/${BPN}
-
-        # Log files
-        install -m 755 -d ${D}${localstatedir}/log/${BPN}
-        chown ${PN}:${PN} ${D}${localstatedir}/log/${BPN}
+    # install binaries
+    install -d ${D}${bindir}
+    for i in mongod mongos mongo; do
+        if [ -f ${B}/build/opt/mongo/$i ]; then
+            install -m 0755 ${B}/build/opt/mongo/$i ${D}${bindir}
+        else
+            bbnote "$i does not exist"
+        fi
+    done
+
+    # install config
+    install -d ${D}${sysconfdir}
+    install -m 0644 ${S}/debian/mongod.conf ${D}${sysconfdir}
+
+    # install systemd service
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${S}/debian/mongod.service ${D}${systemd_system_unitdir}
+
+    # install mongo data folder
+    install -m 755 -d ${D}${localstatedir}/lib/${BPN}
+    chown ${PN}:${PN} ${D}${localstatedir}/lib/${BPN}
+
+    # Log files
+    install -m 755 -d ${D}${localstatedir}/log/${BPN}
+    chown ${PN}:${PN} ${D}${localstatedir}/log/${BPN}
 }
 
 CONFFILES:${PN} = "${sysconfdir}/mongod.conf"
#6 lore raw

PATCH 7/8 mongodb: Create /var/log/mongodb in runtime

In reply to Peter Kjellerstedt

/var/log is normally a link to /var/volatile/log and /var/volatile is a tmpfs mount. So anything created in /var/log will not be available when the tmpfs is mounted.

---
 .../meta-python/recipes-dbs/mongodb/mongodb_git.bb | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb +11 -3
index 461a1d007..1b11bd4dc 100644
@@ -113,11 +113,19 @@ scons_do_install() {
     install -m 755 -d ${D}${localstatedir}/lib/${BPN}
     chown ${PN}:${PN} ${D}${localstatedir}/lib/${BPN}
 
-    # Log files
-    install -m 755 -d ${D}${localstatedir}/log/${BPN}
-    chown ${PN}:${PN} ${D}${localstatedir}/log/${BPN}
+    # Create /var/log/mongodb in runtime.
+    if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then
+        install -d ${D}${nonarch_libdir}/tmpfiles.d
+        echo "d ${localstatedir}/log/${BPN} 0755 ${BPN} ${BPN} -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
+    fi
+    if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then
+        install -d ${D}${sysconfdir}/default/volatiles
+        echo "d ${BPN} ${BPN} 0755 ${localstatedir}/log/${BPN} none" > ${D}${sysconfdir}/default/volatiles/99_${BPN}
+    fi
 }
 
 CONFFILES:${PN} = "${sysconfdir}/mongod.conf"
 
 SYSTEMD_SERVICE:${PN} = "mongod.service"
+
+FILES:${PN} += "${nonarch_libdir}/tmpfiles.d"
#7 lore raw

PATCH 8/8 opensaf: Create /var/log/opensaf/saflog in runtime

In reply to Peter Kjellerstedt

/var/log is normally a link to /var/volatile/log and /var/volatile is a tmpfs mount. So anything created in /var/log will not be available when the tmpfs is mounted.

---
 .../recipes-daemons/opensaf/opensaf_5.21.09.bb     | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
meta-networking/recipes-daemons/opensaf/opensaf_5.21.09.bb +14 -0
index 6c8a48179..1aacae9a6 100644
@@ -55,15 +55,29 @@ LDFLAGS += "-Wl,--as-needed -latomic -Wl,--no-as-needed"
 do_install:append() {
     rm -fr "${D}${localstatedir}/lock"
     rm -fr "${D}${localstatedir}/run"
+    rmdir "${D}${localstatedir}/log/${BPN}/saflog"
+    rmdir "${D}${localstatedir}/log/${BPN}"
+    rmdir "${D}${localstatedir}/log"
     rmdir --ignore-fail-on-non-empty "${D}${localstatedir}"
     rmdir --ignore-fail-on-non-empty "${D}${datadir}/java"
     if [ ! -d "${D}${sysconfdir}/init.d" ]; then
         install -d ${D}${sysconfdir}/init.d
         install -m 0755 ${B}/osaf/services/infrastructure/nid/scripts/opensafd ${D}${sysconfdir}/init.d/
     fi
+
+    # Create /var/log/opensaf/saflog in runtime.
+    if [ "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" ]; then
+        install -d ${D}${nonarch_libdir}/tmpfiles.d
+        echo "d ${localstatedir}/log/${BPN}/saflog - - - -" > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
+    fi
+    if [ "${@bb.utils.filter('DISTRO_FEATURES', 'sysvinit', d)}" ]; then
+        install -d ${D}${sysconfdir}/default/volatiles
+        echo "d root root 0755 ${localstatedir}/log/${BPN}/saflog none" > ${D}${sysconfdir}/default/volatiles/99_${BPN}
+    fi
 }
 
 FILES:${PN} += "${libdir}/libSa*.so ${systemd_unitdir}/system/*.service"
+FILES:${PN} += "${nonarch_libdir}/tmpfiles.d"
 FILES:${PN}-dev += "${libdir}/libopensaf_core.so"
 FILES:${PN}-staticdev += "${PKGLIBDIR}/*.a"