When running under systemd, cups needs to be configured with
'--with-rundir=/run/cups', as systemd takes an exception to the
activation socket being under /var/run and relocates it.

This leads to fd duplication in cupsd and an inadvertent closure of the
activation socket when the daemon exits due to inactivity, so that the
daemon cannot be activated again.

[YOCTO #14152]

Signed-off-by: Oleksandr Kravchuk <[email protected]>
---
 meta/recipes-extended/cups/cups.inc | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/recipes-extended/cups/cups.inc 
b/meta/recipes-extended/cups/cups.inc
index e7a704134c..ff1ab70be9 100644
--- a/meta/recipes-extended/cups/cups.inc
+++ b/meta/recipes-extended/cups/cups.inc
@@ -56,8 +56,11 @@ EXTRA_OECONF = " \
                --enable-libusb \
                --with-domainsocket=/run/cups/cups.sock \
                DSOFLAGS='${LDFLAGS}' \
+               ${EXTRA_OECONF_SYSTEMD} \
                "
 
+EXTRA_OECONF_SYSTEMD = 
"${@bb.utils.contains('DISTRO_FEATURES','systemd','--with-rundir=/run/cups','',d)}"
+
 EXTRA_AUTORECONF += "--exclude=autoheader"
 
 do_compile () {
@@ -77,6 +80,7 @@ do_install () {
 
        # Remove /var/run from package as cupsd will populate it on startup
        rm -fr ${D}/${localstatedir}/run
+       rm -rf ${D}/run
        rm -fr ${D}/${localstatedir}/log
        rmdir ${D}/${libexecdir}/${BPN}/driver
 
@@ -97,6 +101,11 @@ do_install () {
            install -m 0644 ${WORKDIR}/volatiles.99_cups \
                    ${D}${sysconfdir}/default/volatiles/99_cups
        fi
+
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', 
d)}; then
+        install -d ${D}${sysconfdir}/tmpfiles.d
+        echo "d /run/${BPN}/cert 0755 - - - -" > 
${D}${sysconfdir}/tmpfiles.d/cups.conf
+    fi
 }
 
 PACKAGES =+ "${PN}-lib ${PN}-libimage"
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#148405): 
https://lists.openembedded.org/g/openembedded-core/message/148405
Mute This Topic: https://lists.openembedded.org/mt/80809459/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to