public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH 1/1] systemd-compat-units: pkg_postinst() does not work
@ 2016-08-15 23:04 Joe Slater
  2016-08-17 16:48 ` Richard Purdie
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Slater @ 2016-08-15 23:04 UTC (permalink / raw)
  To: openembedded-core

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>
---
 meta/recipes-core/systemd/systemd-compat-units.bb |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb
index 0b8ff09..8ad10ae 100644
--- a/meta/recipes-core/systemd/systemd-compat-units.bb
+++ b/meta/recipes-core/systemd/systemd-compat-units.bb
@@ -3,7 +3,7 @@ SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
 
-PR = "r29"
+PR = "r30"
 
 DEPENDS = "systemd-systemctl-native"
 
@@ -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"
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] systemd-compat-units: pkg_postinst() does not work
  2016-08-15 23:04 [PATCH 1/1] systemd-compat-units: pkg_postinst() does not work Joe Slater
@ 2016-08-17 16:48 ` Richard Purdie
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2016-08-17 16:48 UTC (permalink / raw)
  To: Joe Slater, openembedded-core

On Mon, 2016-08-15 at 16:04 -0700, Joe Slater wrote:
> 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>
> ---
>  meta/recipes-core/systemd/systemd-compat-units.bb |   19 +++++++++++
> --------
>  1 file changed, 11 insertions(+), 8 deletions(-)

This appears to break non-systemd world builds:

https://autobuilder.yoctoproject.org/main/builders/nightly-no-x11/builds/239/steps/BuildImages/logs/stdio

We probably need to make it depend on the systemd DISTRO_FEATURE. I
appreciate its a side effect of your patch rather than a direct cause.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-17 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-15 23:04 [PATCH 1/1] systemd-compat-units: pkg_postinst() does not work Joe Slater
2016-08-17 16:48 ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox