Skip to contentSkip to conversation

How to iherit class based on a conditional variable? #sysvinit #systemd

DISCUSSION Bel Hadj Salem Talel 2 participants 2 messages Oct 25, 2021

lore
Share & tools
lore
#0 lore raw

Hello,

I have a recipe that installs a simple bash script to run on startup. As you all know, there is systemd and sysvinit.
I need to add support for both init managers.

I can do :
SRC_URI_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://script.service', 'file://script.sh', d)}"

and I can do the same in all the tasks.

The problem is, that I need to inherit either systemd or update-rc.d

Is it possible to inherit them all, or how can I inherit something conditionally ?

Thanks,
Talel

#1 lore raw

It's fine to inherit both classes and install both files without even checking DISTRO_FEATURES. There's behind the scenes magic that will do the right thing depending on what init manager is chosen in the distro config.

Alex

Quoted 33 lines · Bel Hadj Salem Talel

Hello,

I have a recipe that installs a simple bash script to run on startup. As you all know, there is systemd and sysvinit.
I need to add support for both init managers.

I can do :
SRC_URI_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'file://script.service', 'file://script.sh', d)}"

and I can do the same in all the tasks.

The problem is, that I need to inherit either systemd or update-rc.d

Is it possible to inherit them all, or how can I inherit something conditionally ?

Thanks,
Talel

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#55135):
https://lists.yoctoproject.org/g/yocto/message/55135
Mute This Topic: https://lists.yoctoproject.org/mt/86575814/1686489
Mute #sysvinit:https://lists.yoctoproject.org/g/yocto/mutehashtag/sysvinit Mute #systemd:https://lists.yoctoproject.org/g/yocto/mutehashtag/systemd Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-