[meta-virtualization] [PATCH] lxc: install lxc.service if DISTRO_FEATURES contains systemd

Erik Botö erik.boto at pelagicore.com
Tue Jun 9 06:28:58 PDT 2015


On Tue, Jun 9, 2015 at 3:02 PM, Bruce Ashfield <bruce.ashfield at gmail.com> wrote:
> On Tue, Jun 9, 2015 at 1:14 AM, Erik Botö <erik.boto at pelagicore.com> wrote:
>> Signed-off-by: Erik Botö <erik.boto at pelagicore.com>
>> ---
>>  recipes-containers/lxc/lxc_1.0.7.bb | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/recipes-containers/lxc/lxc_1.0.7.bb b/recipes-containers/lxc/lxc_1.0.7.bb
>> index f79ba76..948dd0f 100644
>> --- a/recipes-containers/lxc/lxc_1.0.7.bb
>> +++ b/recipes-containers/lxc/lxc_1.0.7.bb
>> @@ -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).

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

>
> 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
>
>
>> +
>>         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
>> meta-virtualization at yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/meta-virtualization
>
>
>
> --
> "Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end"



-- 
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: erik.boto at pelagicore.com

PELAGICORE Experience Change


More information about the meta-virtualization mailing list