[v2,2/7] systemd: skip postinst in nativesdk builds

Message ID 20211119113429.502652-2-luca.boccassi@gmail.com
State New
Headers show
Series [v2,1/7] systemd: skip chown when building for nativesdk | expand

Commit Message

Luca Boccassi Nov. 19, 2021, 11:34 a.m. UTC
From: Luca Boccassi <luca.boccassi@microsoft.com>

They will fail, as there's nowhere to run them

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
---
v2: use "${PN}" = "${BPN}" as suggested by reviewers

 meta/recipes-core/systemd/systemd_249.5.bb | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch

diff --git a/meta/recipes-core/systemd/systemd_249.5.bb b/meta/recipes-core/systemd/systemd_249.5.bb
index 2df2de0cf3..ec9c350297 100644
--- a/meta/recipes-core/systemd/systemd_249.5.bb
+++ b/meta/recipes-core/systemd/systemd_249.5.bb
@@ -773,12 +773,18 @@  ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
 ALTERNATIVE_PRIORITY[runlevel] ?= "300"
 
 pkg_postinst:${PN}:libc-glibc () {
+	if [ "${PN}" != "${BPN}" ]; then
+		exit 0
+	fi
 	sed -e '/^hosts:/s/\s*\<myhostname\>//' \
 		-e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \
 		-i $D${sysconfdir}/nsswitch.conf
 }
 
 pkg_prerm:${PN}:libc-glibc () {
+	if [ "${PN}" != "${BPN}" ]; then
+		exit 0
+	fi
 	sed -e '/^hosts:/s/\s*\<myhostname\>//' \
 		-e '/^hosts:/s/\s*myhostname//' \
 		-i $D${sysconfdir}/nsswitch.conf
@@ -786,6 +792,9 @@  pkg_prerm:${PN}:libc-glibc () {
 
 PACKAGE_WRITE_DEPS += "qemu-native"
 pkg_postinst:udev-hwdb () {
+	if [ "${PN}" != "${BPN}" ]; then
+		exit 0
+	fi
 	if test -n "$D"; then
 		$INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}"
 	else
@@ -794,5 +803,8 @@  pkg_postinst:udev-hwdb () {
 }
 
 pkg_prerm:udev-hwdb () {
+	if [ "${PN}" != "${BPN}" ]; then
+		exit 0
+	fi
 	rm -f $D${sysconfdir}/udev/hwdb.bin
 }