[yocto] Adding to inittab based on image content

Rudolf J Streif rudolf.streif at gmail.com
Sat Jan 7 08:50:10 PST 2017


On Saturday, January 7, 2017 10:23:50 AM PST Mike Looijmans wrote:
> On 06-01-17 18:17, Rudolf J Streif wrote:
> > 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
> > }
> 
> Problems are that if you upgrade the application on target, it'll be
> included twice, and that when you remove the application, the inittab
> entry remains. If inittab itsef gets upgraded, the entry will be gone.
> 

For the former, you use your imagination and scripting skills to see if the 
entry is already there and remove it or you use pkg_preinst_${PN} to remove 
the entry before installing.

For the latter pkg_prerm_${PN} and pkg_postrm_${PN} are at your disposition.

The problem you stated is actually independent of the build system. It is part 
of the package management. For RPM, for example, the scripts get copied into 
the respective sections of the package manifest:

pgk_preinst -> %pre
pkg_post_inst -> %post
pkg_prerm -> %preun
pkg_postrm -> %postun

Accordingly for the other package management systems.


-- 
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/20170107/626a3b0d/attachment.pgp>


More information about the yocto mailing list