Skip to contentSkip to conversation

lxc: install lxc.service if DISTRO_FEATURES contains systemd

PATCH In review Erik Botö 2 participants 3 messages Jun 9, 2015

lore
Share & tools
lore

Erik Botö

author
#0 lore raw

PATCH 1/1 lxc: install lxc.service if DISTRO_FEATURES contains systemd

---
 recipes-containers/lxc/lxc_1.0.7.bb | 5 +++++
 1 file changed, 5 insertions(+)
recipes-containers/lxc/lxc_1.0.7.bb +5 -0
index f79ba76..948dd0f 100644
@@ -94,6 +94,11 @@ do_install_append() {
 	for i in `grep -l "#! */bin/bash" ${D}${datadir}/lxc/hooks/*`; do \
 	    sed -e 's|#! */bin/bash|#!/bin/sh|' -i $i; done
 
+	if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+	    install -d ${D}${systemd_unitdir}/system/
+	    cp ${S}/config/init/systemd/lxc.service ${D}${systemd_unitdir}/system/
+	fi
+
 	if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
 	    install -d ${D}${sysconfdir}/init.d
 	    cp ${S}/config/init/sysvinit/lxc ${D}${sysconfdir}/init.d
Signature · 1 line
1.9.1
#1 lore raw
Quoted 10 lines · Erik Botö
---
 recipes-containers/lxc/lxc_1.0.7.bb | 5 +++++
 1 file changed, 5 insertions(+)
recipes-containers/lxc/lxc_1.0.7.bb +0 -0
index f79ba76..948dd0f 100644

recipes-containers/lxc/lxc_1.0.7.bb do_install_append() { · line 100

Quoted 7 lines
recipes-containers/lxc/lxc_1.0.7.bb +4 -0
@@ -94,6 +94,11 @@ do_install_append() {
        for i in `grep -l "#! */bin/bash" ${D}${datadir}/lxc/hooks/*`; do \
            sed -e 's|#! */bin/bash|#!/bin/sh|' -i $i; done
 
+       if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+           install -d ${D}${systemd_unitdir}/system/
+           cp ${S}/config/init/systemd/lxc.service ${D}${systemd_unitdir}/system/
+       fi

We actually don't need this, I introduced a similar copy in January of this year, and subsequently
removed it, since the line:

EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '--with-init-script=sysvinit', '--with-init-script=systemd', d)}"

Takes care of the proper generation and install of the service files (and sysvinit scripts).

If we are having issues with startup, we need to see what broke since I made the change
and tested it.

Also note that SYSTEMD_AUTO_ENABLE_${PN}-setup is currently set to "disable", so you do need to enable the systemd init parts as well.

Bruce

Quoted 12 lines
recipes-containers/lxc/lxc_1.0.7.bb +1 -1
+
        if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
            install -d ${D}${sysconfdir}/init.d
            cp ${S}/config/init/sysvinit/lxc ${D}${sysconfdir}/init.d
--

1.9.1

--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"
author
#2 lore raw
Quoted 23 lines · Bruce Ashfield
Quoted 10 lines · Erik Botö
---
 recipes-containers/lxc/lxc_1.0.7.bb | 5 +++++
 1 file changed, 5 insertions(+)
recipes-containers/lxc/lxc_1.0.7.bb +0 -0
index f79ba76..948dd0f 100644

recipes-containers/lxc/lxc_1.0.7.bb do_install_append() { · line 100

Quoted 7 lines
recipes-containers/lxc/lxc_1.0.7.bb +4 -0
@@ -94,6 +94,11 @@ do_install_append() {
        for i in `grep -l "#! */bin/bash" ${D}${datadir}/lxc/hooks/*`; do \
            sed -e 's|#! */bin/bash|#!/bin/sh|' -i $i; done
 
+       if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+           install -d ${D}${systemd_unitdir}/system/
+           cp ${S}/config/init/systemd/lxc.service ${D}${systemd_unitdir}/system/
+       fi

We actually don't need this, I introduced a similar copy in January of this year, and subsequently
removed it, since the line:

Quoted 5 lines

EXTRA_OECONF += "${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '--with-init-script=sysvinit', '--with-init-script=systemd', d)}"

Takes care of the proper generation and install of the service files (and sysvinit scripts).

I think it's a valid use case to have both systemd and sysvinit in DISTRO_FEATURES. With the current recipe the service-file won't be installed and the systemd.bbclass will complain.

I noticed that lxc configure accept multiple values (comma separated) for --with-init-script, so this should work:

EXTRA_OECONF += "--with-init-script=\
${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit,', '', d)}\
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)}"

I'll send a new version of the patch.

Cheers,
Erik

Quoted 29 lines

If we are having issues with startup, we need to see what broke since I made the change
and tested it.

Also note that SYSTEMD_AUTO_ENABLE_${PN}-setup is currently set to "disable", so you do need to enable the systemd init parts as well.

Bruce

Quoted 7 lines
recipes-containers/lxc/lxc_1.0.7.bb +1 -1
+
        if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
            install -d ${D}${sysconfdir}/init.d
            cp ${S}/config/init/sysvinit/lxc ${D}${sysconfdir}/init.d
--

1.9.1

Quoted 5 lines

--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

--
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"

Signature · 10 lines
Erik Botö
M.Sc.E.E.
SENIOR SOFTWARE ENGINEER

Pelagicore AB
Ekelundsgatan 4, 6tr, SE-411 18 Gothenburg, Sweden
Mobile: +46 (0)768 817 203
E-Mail: [email protected]

PELAGICORE Experience Change