* Adding to inittab based on image content
@ 2017-01-06 13:39 colin.helliwell
2017-01-06 17:17 ` Rudolf J Streif
0 siblings, 1 reply; 5+ messages in thread
From: colin.helliwell @ 2017-01-06 13:39 UTC (permalink / raw)
To: yocto
[-- Attachment #1: Type: text/plain, Size: 598 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 2624 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding to inittab based on image content
2017-01-06 13:39 Adding to inittab based on image content colin.helliwell
@ 2017-01-06 17:17 ` Rudolf J Streif
2017-01-07 9:23 ` Mike Looijmans
2017-01-11 9:16 ` colin.helliwell
0 siblings, 2 replies; 5+ messages in thread
From: Rudolf J Streif @ 2017-01-06 17:17 UTC (permalink / raw)
To: yocto, colin.helliwell
[-- Attachment #1: Type: text/plain, Size: 1608 bytes --]
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@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
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 484 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding to inittab based on image content
2017-01-06 17:17 ` Rudolf J Streif
@ 2017-01-07 9:23 ` Mike Looijmans
2017-01-07 16:50 ` Rudolf J Streif
2017-01-11 9:16 ` colin.helliwell
1 sibling, 1 reply; 5+ messages in thread
From: Mike Looijmans @ 2017-01-07 9:23 UTC (permalink / raw)
To: yocto
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.
>
> 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@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
>
>
>
>
--
Mike Looijmans
Kind regards,
Mike Looijmans
System Expert
TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijmans@topicproducts.com
Website: www.topicproducts.com
Please consider the environment before printing this e-mail
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding to inittab based on image content
2017-01-07 9:23 ` Mike Looijmans
@ 2017-01-07 16:50 ` Rudolf J Streif
0 siblings, 0 replies; 5+ messages in thread
From: Rudolf J Streif @ 2017-01-07 16:50 UTC (permalink / raw)
To: yocto
[-- Attachment #1: Type: text/plain, Size: 1352 bytes --]
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
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 484 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding to inittab based on image content
2017-01-06 17:17 ` Rudolf J Streif
2017-01-07 9:23 ` Mike Looijmans
@ 2017-01-11 9:16 ` colin.helliwell
1 sibling, 0 replies; 5+ messages in thread
From: colin.helliwell @ 2017-01-11 9:16 UTC (permalink / raw)
To: yocto
Thanks Rudi, that's got it.
-----Original Message-----
From: Rudolf J Streif [mailto:rudolf.streif@gmail.com]
Sent: 06 January 2017 17:18
To: yocto@yoctoproject.org; colin.helliwell@ln-systems.com
Subject: Re: [yocto] Adding to inittab based on image content
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-01-11 9:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-06 13:39 Adding to inittab based on image content colin.helliwell
2017-01-06 17:17 ` Rudolf J Streif
2017-01-07 9:23 ` Mike Looijmans
2017-01-07 16:50 ` Rudolf J Streif
2017-01-11 9:16 ` colin.helliwell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.