]> code.ossystems Code Review - openembedded-core.git/commitdiff
systemd-compat-units: pkg_postinst() does not work
authorJoe Slater <jslater@windriver.com>
Mon, 15 Aug 2016 23:04:53 +0000 (16:04 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 18 Aug 2016 15:52:01 +0000 (16:52 +0100)
The test for various files is wrong and will always be
true, even if init.d does not exist.

Exit if init.d does not exist, and correctly test for
file existence otherwise.

Signed-off-by: Joe Slater <jslater@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-core/systemd/systemd-compat-units.bb

index 0b8ff09b2b3c5e091336a02cdddd58cfc6202d74..90811da1bce53bf0c3b35674b017ab4a1055024e 100644 (file)
@@ -23,21 +23,24 @@ SYSTEMD_DISABLED_SYSV_SERVICES = " \
 "
 
 pkg_postinst_${PN} () {
-       cd $D${sysconfdir}/init.d
 
-       echo "Disabling the following sysv scripts: "
+       cd $D${sysconfdir}/init.d  ||  exit 0
 
-       OPTS=""
+       echo "Disabling the following sysv scripts: "
 
        if [ -n "$D" ]; then
                OPTS="--root=$D"
+       else
+               OPTS=""
        fi
 
        for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do
-               if [ \( -e $i -o $i.sh \) -a ! \( -e $D${sysconfdir}/systemd/system/$i.service -o  -e $D${systemd_unitdir}/system/$i.service \) ] ; then
-                       echo -n "$i: " ; systemctl ${OPTS} mask $i.service
+               if [ -e $i -o -e $i.sh ]  &&   ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_unitdir}/system/$i.service ] ; then
+                       echo -n "$i: "
+                       systemctl $OPTS mask $i.service
                fi
-       done ; echo
+       done
+       echo
 }
 
-RDPEPENDS_${PN} = "systemd"
+RDEPENDS_${PN} = "systemd"