diff mbox series

[nanbield,30/41] systemd-compat-units.bb: fix postinstall script

Message ID d114814fa2628cfea2769d65a26514b76e61a0fa.1703864512.git.steve@sakoman.com
State New, archived
Headers show
Series [nanbield,01/41] cve-update-nvd2-native: remove unused variable CVE_SOCKET_TIMEOUT | expand

Commit Message

Steve Sakoman Dec. 29, 2023, 3:44 p.m. UTC
From: Michael Opdenacker <michael.opdenacker@bootlin.com>

This fixes an issue running "opkg upgrade" on a system with systemd
(and when there is an update to "systemd-compat-units",
for example between yocto 4.2.2 and 4.2.3):

//var/lib/opkg/info/systemd-compat-units.postinst: cd: line 3: can't cd to /etc/init.d: No such file or directory

The existence of /etc/init.d is now tested
without causing an error if doesn't exist.

Fixes [YOCTO #15292]

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0330331a1386fd2a34b410a7f62b29bfc8dc23c4)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/recipes-core/systemd/systemd-compat-units.bb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
index 253bc9fcf1..c03d97f9c9 100644
--- a/meta/recipes-core/systemd/systemd-compat-units.bb
+++ b/meta/recipes-core/systemd/systemd-compat-units.bb
@@ -27,7 +27,8 @@  SYSTEMD_DISABLED_SYSV_SERVICES = " \
 
 pkg_postinst:${PN} () {
 
-	cd $D${sysconfdir}/init.d  ||  exit 0
+	test -d $D${sysconfdir}/init.d  ||  exit 0
+	cd $D${sysconfdir}/init.d
 
 	echo "Disabling the following sysv scripts: "