]> code.ossystems Code Review - openembedded-core.git/commitdiff
systemd: Fix systemd when used with busybox less
authorAlban Bedel <alban.bedel@aerq.com>
Tue, 3 Nov 2020 15:13:34 +0000 (16:13 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 13 Nov 2020 14:31:56 +0000 (14:31 +0000)
Per default systemd use a pager for the output of most of its tools
and it expect this pager to be color capable. But that is not the case
when the busybox `less` is used, which lead to output garbled by color
escape sequences.

To fix this issue add a profile frament that disable the systemd pager
when busybox `less` is detected.

Signed-off-by: Alban Bedel <alban.bedel@aerq.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/systemd/systemd/systemd-pager.sh [new file with mode: 0644]
meta/recipes-core/systemd/systemd_246.6.bb

diff --git a/meta/recipes-core/systemd/systemd/systemd-pager.sh b/meta/recipes-core/systemd/systemd/systemd-pager.sh
new file mode 100644 (file)
index 0000000..86e3e0a
--- /dev/null
@@ -0,0 +1,7 @@
+# Systemd expect a color capable pager, however the less provided
+# by busybox is not. This make many interaction with systemd pretty
+# annoying. As a workaround we disable the systemd pager if less
+# is not the GNU version.
+if ! less -V > /dev/null 2>&1 ; then
+       export SYSTEMD_PAGER=
+fi
index 78990f41ec512f42b09eef1af3e950a9d6830be5..1d1ff34d898682a058887d7eecbdcb85d6901a59 100644 (file)
@@ -18,6 +18,7 @@ SRC_URI += "file://touchscreen.rules \
            file://00-create-volatile.conf \
            file://init \
            file://99-default.preset \
+           file://systemd-pager.sh \
            file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
            file://0003-implment-systemd-sysv-install-for-OE.patch \
            file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \
@@ -306,6 +307,9 @@ do_install() {
        # install default policy for presets
        # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
        install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset
+
+       # 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
 }
 
 python populate_packages_prepend (){
@@ -539,6 +543,7 @@ FILES_${PN} = " ${base_bindir}/* \
                 ${sysconfdir}/dbus-1/ \
                 ${sysconfdir}/modules-load.d/ \
                 ${sysconfdir}/pam.d/ \
+                ${sysconfdir}/profile.d/ \
                 ${sysconfdir}/sysctl.d/ \
                 ${sysconfdir}/systemd/ \
                 ${sysconfdir}/tmpfiles.d/ \