All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] systat: systemd never enables the service
Date: Tue, 18 Jun 2019 12:06:17 +0200	[thread overview]
Message-ID: <20190618100617.25265-1-sbabic@denx.de> (raw)

Even if SYSTEMD_AUTO_ENABLE is set to "enable", the service is never
activated by systemd. The cause is the postinst function in the recipe:

 pkg_postinst_${PN} () {
         if [ -n "$D" ]; then
                 exit 0
         fi
         if [ -e /etc/init.d/populate-volatile.sh ]; then
                 /etc/init.d/populate-volatile.sh update
         fi
 }

This generates with activated systemd the following postinst script:

	set -e
	        if [ -n "$D" ]; then
	                exit 0
	        fi
	        if [ -e /etc/init.d/populate-volatile.sh ]; then
	                /etc/init.d/populate-volatile.sh update
	        fi
	OPTS=""

	if [ -n "$D" ]; then
	    OPTS="--root=$D"
	fi

	if type systemctl >/dev/null 2>/dev/null; then
		if [ -z "$D" ]; then
			systemctl daemon-reload
		fi

		systemctl $OPTS enable sysstat.service

		if [ -z "$D" -a "enable" = "enable" ]; then
			systemctl --no-block restart sysstat.service
		fi
	fi

Due to the exit statement, systemctl is never called and the service is
never enabled in rootfs.
Invert the logic for the check to let run the rest of postinst script.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 meta/recipes-extended/sysstat/sysstat.inc | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/meta/recipes-extended/sysstat/sysstat.inc b/meta/recipes-extended/sysstat/sysstat.inc
index 0bc7e14d36..850a6d1465 100644
--- a/meta/recipes-extended/sysstat/sysstat.inc
+++ b/meta/recipes-extended/sysstat/sysstat.inc
@@ -51,12 +51,11 @@ do_install() {
 }
 
 pkg_postinst_${PN} () {
-        if [ -n "$D" ]; then
-                exit 0
-        fi
-        if [ -e /etc/init.d/populate-volatile.sh ]; then
-                /etc/init.d/populate-volatile.sh update
-        fi
+	if [  ! -n "$D" ]; then
+		if [ -e /etc/init.d/populate-volatile.sh ]; then
+			/etc/init.d/populate-volatile.sh update
+		fi
+	fi
 }
 
 
-- 
2.17.1



             reply	other threads:[~2019-06-18 10:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18 10:06 Stefano Babic [this message]
2019-06-18 10:30 ` ✗ patchtest: failure for systat: systemd never enables the service Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2019-05-31  8:54 [PATCH] " Stefano Babic
2019-06-17  5:44 ` Khem Raj
2019-06-18  9:47   ` Stefano Babic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190618100617.25265-1-sbabic@denx.de \
    --to=sbabic@denx.de \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.