systemd-compat-units: pkg_postinst() does not work

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.

(From OE-Core rev: 8183309080aee45746daaff46b0506b09b5bd269)

Signed-off-by: Joe Slater <jslater@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joe Slater
2016-08-15 16:04:53 -07:00
committed by Richard Purdie
parent 6c24a6446a
commit bcc8b87c72

View File

@@ -23,21 +23,24 @@ SYSTEMD_DISABLED_SYSV_SERVICES = " \
"
pkg_postinst_${PN} () {
cd $D${sysconfdir}/init.d
cd $D${sysconfdir}/init.d || exit 0
echo "Disabling the following sysv scripts: "
OPTS=""
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"