Patchwork [meta-system,1/2] systemd.bbclass: introduce SYSTEMD_AUTO_ENABLE variable

login
register
mail settings
Submitter Andreas Müller
Date July 13, 2012, 11:10 a.m.
Message ID <1342177846-26594-2-git-send-email-schnitzeltony@googlemail.com>
Download mbox | patch
Permalink /patch/31957/
State Accepted
Commit 6e6bd9af71047e6f3b867d23bbbcca320ae2f1e8
Headers show

Comments

Andreas Müller - July 13, 2012, 11:10 a.m.
Currently all services introduced are enabled and started at installation. By
setting SYSTEMD_AUTO_ENABLE = "disable" the default behaviour can be
overridden.

Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
 meta-systemd/classes/systemd.bbclass |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Otavio Salvador - July 13, 2012, 3:28 p.m.
On Fri, Jul 13, 2012 at 8:10 AM, Andreas Müller
<schnitzeltony@googlemail.com> wrote:
> Currently all services introduced are enabled and started at installation. By
> setting SYSTEMD_AUTO_ENABLE = "disable" the default behaviour can be
> overridden.

I like the idea but this might be nicer to have it by image; we could
check, in postinst, for:

$SYSTEMD_ENABLE at runtime, so we can set it in image file.
Andreas Müller - July 13, 2012, 9:18 p.m.
On Fri, Jul 13, 2012 at 5:28 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:
> On Fri, Jul 13, 2012 at 8:10 AM, Andreas Müller
> <schnitzeltony@googlemail.com> wrote:
>> Currently all services introduced are enabled and started at installation. By
>> setting SYSTEMD_AUTO_ENABLE = "disable" the default behaviour can be
>> overridden.
>
> I like the idea but this might be nicer to have it by image; we could
> check, in postinst, for:
>
> $SYSTEMD_ENABLE at runtime, so we can set it in image file.
>
If I understand you correct, you suggest an image global for this?
From my point of view we then put things together which we shouldn't.
For instance: my preferred next candidate would be gateone. Nice to
have on the machine but not mandatory to start at every boot. It takes
long time and is more a on demand thing. What do gateone and udisks
share in common?

Andreas

Patch

diff --git a/meta-systemd/classes/systemd.bbclass b/meta-systemd/classes/systemd.bbclass
index 8af0d58..38b9ed5 100644
--- a/meta-systemd/classes/systemd.bbclass
+++ b/meta-systemd/classes/systemd.bbclass
@@ -1,5 +1,7 @@ 
 DEPENDS_append = " systemd-systemctl-native"
 
+SYSTEMD_AUTO_ENABLE ??= "enable"
+
 systemd_postinst() {
 OPTS=""
 
@@ -7,9 +9,9 @@  if [ -n "$D" ]; then
     OPTS="--root=$D"
 fi
 
-systemctl $OPTS enable ${SYSTEMD_SERVICE}
+systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE}
 
-if [ -z "$D" ]; then
+if [ -z "$D" -a ${SYSTEMD_AUTO_ENABLE} = "enable" ]; then
     systemctl start ${SYSTEMD_SERVICE}
 fi
 }