Originally, this recipe masked the units at rootfs-time by looking to see
if the init script to be masked existed, and masking it if so.
That however suffers from a race condition where the postinst script may
be executed before the package that provides a script has been installed
so this was changed to be an on-target postinst[1], so we know that all
of the packages have been installed.
However, this now means that you can't have an image that install this
package _and_ is read-only, because we have an on-target postinst to
execute.
There's also another problem that with on-target package management, it
would be possible to install a package that should be masked after the
postinst has been executed, so the mask won't exist.
Taking a step back, a systemd unit mask is just a symlink to /dev/null
with the right name in the right path. So instead of masking in a post-
install script, we can generate all the masks at build-time.
This change reduces this package to just a number of symlinks, with no
post-install scripts.
[ YOCTO #16109 ]
[1] oe-core
e88f22da19 ("systemd-compat-units: execute postinst on target")
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
LICENSE = "MIT"
-PACKAGE_WRITE_DEPS += "systemd-systemctl-native"
+DEPENDS = "systemd-systemctl-native"
+INHIBIT_DEFAULT_DEPS = "1"
S = "${UNPACKDIR}"
inherit features_check
-INHIBIT_DEFAULT_DEPS = "1"
-
-ALLOW_EMPTY:${PN} = "1"
-
-REQUIRED_DISTRO_FEATURES += "systemd"
-REQUIRED_DISTRO_FEATURES += "usrmerge"
+REQUIRED_DISTRO_FEATURES = "systemd"
SYSTEMD_DISABLED_SYSV_SERVICES = " \
busybox-udhcpc \
syslog.busybox \
"
-pkg_postinst_ontarget:${PN} () {
-
- test -d $D${sysconfdir}/init.d || exit 0
- cd $D${sysconfdir}/init.d
-
- 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 -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_system_unitdir}/$i.service ] ; then
- echo -n "$i: "
- systemctl $OPTS mask $i.service
- fi
+do_install() {
+ for unit in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do
+ systemctl --root ${D} mask $unit
done
- echo
}
-
-RDEPENDS:${PN} = "systemd"