[yocto] Script being installed under /etc/init.d instead of /usr/lib/systemd folder

piotr.lewicki piotr.lewicki at elfin.de
Tue Jun 14 08:32:53 PDT 2016


Take a look at example from my some-recipe.bb
:

inherit systemd

SYSTEMD_SERVICE_${PN} = "some-recipe.service"

do_install_append () {
     install -d ${D}${systemd_unitdir}/system
     install -m 0644 ${S}/configs/some-recipe.service 
${D}${systemd_unitdir}/system
}

First in your recipe inherit from "systemd".
Then install your systemd service file in 
"${D}${systemd_unitdir}/system" (there is also a variable for this 
directory, I think it's ${systemd_system_unitdir} or something similar).
Remember to create a directory before placing a file there.

In the last step use "SYSTEMD_SERVICE_${PN}" where you specify systemd 
services that should be run.

I hope that helps..

Best regards,
Piotr Lewicki


On 09.06.2016 03:11, Dey, Megha wrote:
>
> Hi,
>
> I am trying to use the systemd init system from the existing system. I 
> have added the following to my conf file:
>
> DISTRO_FEATURES_append = " systemd"
>
> VIRTUAL-RUNTIME_init_manager = "systemd"
>
> VIRTUAL-RUNTIME_initscripts = ""
>
> DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
>
> I have also added the ‘systemd’ binary to the INSTALL_APPEND.
>
> When I boot the resulting image, I do see systemd up and running and I 
> am able to start and stop services.
>
> However, I do have a script recipe which is currently placed as a 
> bbappend to initscripts 
> (meta/recipes-core/initscripts/initscript_..bb) in my custom meta layer.
>
> This script even after shifting to systemd, is being placed in the 
> /etc/init.d/ folder, and hence doesn’t run on boot. I want this to be 
> placed in the /usr/lib/system.d/ folder instead. How would I be able 
> to do this?
>
> Is it because this script is an append to initscripts, it by default 
> gets installed under /etc/init.d? If so, where should I place the recipe?
>
> Thanks,
>
> Megha
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160614/0d0f3aee/attachment.html>


More information about the yocto mailing list