[yocto] Adding to inittab based on image content

Rudolf J Streif rudolf.streif at gmail.com
Fri Jan 6 09:17:39 PST 2017


Hi Colin,

The correct way of doing this is a package postinstallation script that is run 
by the package manager after the package containing your application is 
installed on the target system.

You add to your recipe:

pkg_postinst_${PN}() {
#!/bin/sh
echo "whateveryouneed" >> ${D}/etc/inittab
}

The build system will include this as the post install script into the package 
in the correct form for the package manager you are using e.g. RPM, DEB, IPK.

This will work when the build system installs your package into the system 
root or when executed on the target.

You can also distinguish the two cases:

pkg_postinst_${PN}() {
#!/bin/sh
if [ x"$D" = "x" ] ; then
   # shell commands for target execution
else
   # shell commands for build system execution
fi
}

In the case of target execution $D is not set.

Best regards,
Rudi


On Friday, January 6, 2017 1:39:40 PM PST colin.helliwell at ln-systems.com 
wrote:
> Hi,
> 
> I have a custom recipe for an application, and the app also needs an entry
> adding to inittab. I'd like to trigger this, obviously, only when the app is
> included in the image.
> 
> I came across some hints at how to do this -
> http://git.yoctoproject.org/cgit/cgit.cgi/meta-virtualization/tree/recipes-c
> ore/sysvinit/sysvinit-inittab_2.88dsf.bbappend?h=dizzy - but the app isn't
> in DISTRO_FEATURES. (Right or wrong.., I include it in the image with a
> "CORE_IMAGE_EXTRA_INSTALL +=" in my image recipe).
> 
> Any suggestions on how to make this inittab addition conditional?
> 
> Thanks


-- 
Rudolf J Streif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20170106/568267f7/attachment.pgp>


More information about the yocto mailing list