All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] systat: systemd never enables the service
@ 2019-05-31  8:54 Stefano Babic
  2019-06-17  5:44 ` Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: Stefano Babic @ 2019-05-31  8:54 UTC (permalink / raw)
  To: openembedded-devel

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



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

* Re: [PATCH] systat: systemd never enables the service
  2019-05-31  8:54 [PATCH] systat: systemd never enables the service Stefano Babic
@ 2019-06-17  5:44 ` Khem Raj
  2019-06-18  9:47   ` Stefano Babic
  0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2019-06-17  5:44 UTC (permalink / raw)
  To: Stefano Babic; +Cc: openembeded-devel

this is wrong ml for this package, please send this to oe-core ml.

On Fri, May 31, 2019 at 2:04 AM Stefano Babic <sbabic@denx.de> wrote:
>
> 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
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


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

* Re: [PATCH] systat: systemd never enables the service
  2019-06-17  5:44 ` Khem Raj
@ 2019-06-18  9:47   ` Stefano Babic
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Babic @ 2019-06-18  9:47 UTC (permalink / raw)
  To: Khem Raj, Stefano Babic; +Cc: openembeded-devel

On 17/06/19 07:44, Khem Raj wrote:
> this is wrong ml for this package, please send this to oe-core ml.

Ouch...thanks Khem, I will repost.

Stefano

> 
> On Fri, May 31, 2019 at 2:04 AM Stefano Babic <sbabic@denx.de> wrote:
>>
>> 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
>>
>> --
>> _______________________________________________
>> Openembedded-devel mailing list
>> Openembedded-devel@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de
=====================================================================


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

* [PATCH] systat: systemd never enables the service
@ 2019-06-18 10:06 Stefano Babic
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Babic @ 2019-06-18 10:06 UTC (permalink / raw)
  To: openembedded-core

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



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

end of thread, other threads:[~2019-06-18 10:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31  8:54 [PATCH] systat: systemd never enables the service Stefano Babic
2019-06-17  5:44 ` Khem Raj
2019-06-18  9:47   ` Stefano Babic
2019-06-18 10:06 Stefano Babic

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.