From: Changqing Li <[email protected]>

Commit 6fe23ff31c0 changed README to a symlink to README.logs, and
install README.logs under systemd doc dir.

But for OE, systemd doc dir is splited into package systemd-doc, when it
is not installed on the target, there will be an dead link:
Eg:
root@intel-x86-64:/var/log# ls -l README
lrwxrwxrwx 1 root root 39 Jun 20 08:57 README -> 
../../usr/share/doc/systemd/README.logs
root@intel-x86-64:/var/log# ls -l ../../usr/share/doc/systemd/README.logs
ls: cannot access '../../usr/share/doc/systemd/README.logs': No such file or 
directory

First, package this link into systemd-doc to fix above issue.  Second,
create the symlink according to the value of VOLATILE_LOG_DIR, when
VOLATILE_LOG_DIR is true,  /var/log is a link to /var/volatile/log, so
/var/log/README need link to ../../../usr/share/doc/systemd/README.logs,
while VOLATILE_LOG_DIR is false, /var/log is a dir, so /var/log/README
need link to ../../usr/share/doc/systemd/README.logs.

Signed-off-by: Changqing Li <[email protected]>
---
 meta/recipes-core/systemd/systemd_255.1.bb | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd_255.1.bb 
b/meta/recipes-core/systemd/systemd_255.1.bb
index 9e09c89355..db21b70718 100644
--- a/meta/recipes-core/systemd/systemd_255.1.bb
+++ b/meta/recipes-core/systemd/systemd_255.1.bb
@@ -382,10 +382,22 @@ do_install() {
        # add a profile fragment to disable systemd pager with busybox less
        install -Dm 0644 ${WORKDIR}/systemd-pager.sh 
${D}${sysconfdir}/profile.d/systemd-pager.sh
 
-    if [ -n "${WATCHDOG_TIMEOUT}" ]; then
-        sed -i -e 
's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \
-            ${D}/${sysconfdir}/systemd/system.conf
-    fi
+       if [ -n "${WATCHDOG_TIMEOUT}" ]; then
+               sed -i -e 
's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \
+                       ${D}/${sysconfdir}/systemd/system.conf
+       fi
+
+       if [ -f "${D}${nonarch_libdir}/tmpfiles.d/legacy.conf" ] \
+               && grep -q '^L \/var\/log\/README' 
${D}${nonarch_libdir}/tmpfiles.d/legacy.conf 2>/dev/null; then
+
+               sed -i -e '/^L \/var\/log\/README/d' 
${D}${nonarch_libdir}/tmpfiles.d/legacy.conf
+               touch ${D}${nonarch_libdir}/tmpfiles.d/legacy-doc.conf
+               if "${@'true' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) 
else 'false'}"; then
+                       echo "L /var/log/README - - - - 
../../../${datadir}/doc/systemd/README.logs" > 
${D}${nonarch_libdir}/tmpfiles.d/legacy-doc.conf
+               else
+                       echo "L /var/log/README - - - - 
../../${datadir}/doc/systemd/README.logs" > 
${D}${nonarch_libdir}/tmpfiles.d/legacy-doc.conf
+               fi
+       fi
 }
 
 python populate_packages:prepend (){
@@ -622,6 +634,8 @@ FILES:${PN}-udev-rules = "\
                         ${rootlibexecdir}/udev/rules.d/99-systemd.rules \
 "
 
+FILES:${PN}-doc  += "${nonarch_libdir}/tmpfiles.d/legacy-doc.conf"
+
 CONFFILES:${PN} = "${sysconfdir}/systemd/coredump.conf \
        ${sysconfdir}/systemd/journald.conf \
        ${sysconfdir}/systemd/logind.conf \
-- 
2.25.1

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

Reply via email to