]> code.ossystems Code Review - openembedded-core.git/commitdiff
systat: systemd never enables the service
authorStefano Babic <sbabic@denx.de>
Tue, 18 Jun 2019 10:06:17 +0000 (12:06 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 18 Jun 2019 14:55:59 +0000 (15:55 +0100)
Even if SYSTEMD_AUTO_ENABLE is set to "enable", the service is never
activated by systemd. The cause is the postinst function in the recipe:

 pkg_postinst_${PN} () {
         if [ -n "$D" ]; then
                 exit 0
         fi
         if [ -e /etc/init.d/populate-volatile.sh ]; then
                 /etc/init.d/populate-volatile.sh update
         fi
 }

This generates with activated systemd the following postinst script:

set -e
        if [ -n "$D" ]; then
                exit 0
        fi
        if [ -e /etc/init.d/populate-volatile.sh ]; then
                /etc/init.d/populate-volatile.sh update
        fi
OPTS=""

if [ -n "$D" ]; then
    OPTS="--root=$D"
fi

if type systemctl >/dev/null 2>/dev/null; then
if [ -z "$D" ]; then
systemctl daemon-reload
fi

systemctl $OPTS enable sysstat.service

if [ -z "$D" -a "enable" = "enable" ]; then
systemctl --no-block restart sysstat.service
fi
fi

Due to the exit statement, systemctl is never called and the service is
never enabled in rootfs.
Invert the logic for the check to let run the rest of postinst script.

Signed-off-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-extended/sysstat/sysstat.inc

index 6b21c6b8c194f328a49f7433e681fc8426a97f5d..4e29721666031be7a1c99569b819d980544abfcd 100644 (file)
@@ -52,12 +52,11 @@ do_install() {
 }
 
 pkg_postinst_${PN} () {
-        if [ -n "$D" ]; then
-                exit 0
-        fi
-        if [ -e /etc/init.d/populate-volatile.sh ]; then
-                /etc/init.d/populate-volatile.sh update
-        fi
+       if [  ! -n "$D" ]; then
+               if [ -e /etc/init.d/populate-volatile.sh ]; then
+                       /etc/init.d/populate-volatile.sh update
+               fi
+       fi
 }
 
 FILES_${PN} += "${libdir}/sa ${systemd_system_unitdir}"