* Recipes that update a shared file
@ 2013-10-10 0:16 seth bollinger
2013-10-10 9:31 ` Paul Eggleton
0 siblings, 1 reply; 7+ messages in thread
From: seth bollinger @ 2013-10-10 0:16 UTC (permalink / raw)
To: yocto
Hello All,
What's the best practice for recipes that need to update a shared file
provided by a different recipe? For example let's say that the
widget-watcher recipe creates /etc/ww.conf and the widget1, and widget2
recipes need to append a line to the config. I've searched through the
recipes a bit and can't find a good example. The closest that I've seen
is pkg_postinst(). Is that the best method?
Thanks!
Seth
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Recipes that update a shared file
2013-10-10 0:16 Recipes that update a shared file seth bollinger
@ 2013-10-10 9:31 ` Paul Eggleton
2013-10-10 14:36 ` Seth Bollinger
0 siblings, 1 reply; 7+ messages in thread
From: Paul Eggleton @ 2013-10-10 9:31 UTC (permalink / raw)
To: seth bollinger; +Cc: yocto
Hi Seth,
On Wednesday 09 October 2013 19:16:15 seth bollinger wrote:
> What's the best practice for recipes that need to update a shared file
> provided by a different recipe? For example let's say that the
> widget-watcher recipe creates /etc/ww.conf and the widget1, and widget2
> recipes need to append a line to the config. I've searched through the
> recipes a bit and can't find a good example. The closest that I've seen
> is pkg_postinst(). Is that the best method?
That's really the recommended way to do it. If the software being configured
supports it, another way is to set it up to read all configuration files from a
directory and then you can simply install a new file into that directory from
the other recipe (e.g. Apache is usually configured to read all configuration
files in /etc/httpd/conf.d or similar).
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Recipes that update a shared file
2013-10-10 9:31 ` Paul Eggleton
@ 2013-10-10 14:36 ` Seth Bollinger
2013-10-10 14:40 ` Burton, Ross
0 siblings, 1 reply; 7+ messages in thread
From: Seth Bollinger @ 2013-10-10 14:36 UTC (permalink / raw)
To: Paul Eggleton; +Cc: yocto@yoctoproject.org
[-- Attachment #1: Type: text/plain, Size: 1503 bytes --]
On Thu, Oct 10, 2013 at 4:31 AM, Paul Eggleton <
paul.eggleton@linux.intel.com> wrote:
> That's really the recommended way to do it. If the software being
> configured
> supports it, another way is to set it up to read all configuration files
> from a
> directory and then you can simply install a new file into that directory
> from
> the other recipe (e.g. Apache is usually configured to read all
> configuration
> files in /etc/httpd/conf.d or similar).
>
Yes, I would have liked to solve the problem that way, but unfortunately
the software doesn't support it, and we don't want to make changes
currently. :)
I'm having a lot of trouble getting pkg_postinst() to work. From what I've
read, it should happen during rootfs generation, but I'm not see the file
in the rootfs.
I found an example in the xfce4-session_4.10.0.bb recipe. It looks like
/etc/hosts is installed by netbase, so this is very similar to what my
recipe is doing.
# protect from frightening message that xfce might not work correctly
pkg_postinst_${PN} () {
echo 127.0.0.1 ${MACHINE} >> /etc/hosts
}
I've tried this in my recipe, and the file that I expect to be present in
the rootfs is not there...not sure what I'm doing wrong.
pkg_postinst_${PN} () {
echo test >> /etc/inittest2
}
Also, the documentation states that this mechanism can be used to do things
on first boot. Do I need to add code to make sure that this doesn't happen
on first boot?
Thanks!
Seth
[-- Attachment #2: Type: text/html, Size: 2211 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Recipes that update a shared file
2013-10-10 14:36 ` Seth Bollinger
@ 2013-10-10 14:40 ` Burton, Ross
2013-10-10 15:02 ` Seth Bollinger
0 siblings, 1 reply; 7+ messages in thread
From: Burton, Ross @ 2013-10-10 14:40 UTC (permalink / raw)
To: Seth Bollinger; +Cc: Paul Eggleton, yocto@yoctoproject.org
On 10 October 2013 15:36, Seth Bollinger <seth.boll@gmail.com> wrote:
> pkg_postinst_${PN} () {
> echo 127.0.0.1 ${MACHINE} >> /etc/hosts
> }
Yeah, that's broken.
> I've tried this in my recipe, and the file that I expect to be present in
> the rootfs is not there...not sure what I'm doing wrong.
> pkg_postinst_${PN} () {
> echo test >> /etc/inittest2
> }
You need to use $D so that you're not attempting to write to the *host's* /etc:
echo test >> $D/etc/inittest2
In a postinst $D may be set, and if it is then the postinst is being
ran on the host at rootfs time, and points to where the rootfs is
being constructed.
Ross
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Recipes that update a shared file
2013-10-10 14:40 ` Burton, Ross
@ 2013-10-10 15:02 ` Seth Bollinger
2013-10-10 15:09 ` Burton, Ross
0 siblings, 1 reply; 7+ messages in thread
From: Seth Bollinger @ 2013-10-10 15:02 UTC (permalink / raw)
To: Burton, Ross; +Cc: Paul Eggleton, yocto@yoctoproject.org
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
On Thu, Oct 10, 2013 at 9:40 AM, Burton, Ross <ross.burton@intel.com> wrote:
> You need to use $D so that you're not attempting to write to the *host's*
> /etc:
>
> echo test >> $D/etc/inittest2
>
> In a postinst $D may be set, and if it is then the postinst is being
> ran on the host at rootfs time, and points to where the rootfs is
> being constructed.
>
Ok, I changed to as follows:
pkg_postinst_${PN} () {
echo "testtest" >> ${D}/etc/inittest
}
After that I do a find and the file is only populated in the recipe's image
directory, not the rootfs.
$ find . -iname inittest
./tmp/work/armv5te-dbl-linux-gnueabi/widget/1.0-r0/image/etc/inittest
Thanks!
Seth
[-- Attachment #2: Type: text/html, Size: 1268 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Recipes that update a shared file
2013-10-10 15:02 ` Seth Bollinger
@ 2013-10-10 15:09 ` Burton, Ross
2013-10-10 15:17 ` Seth Bollinger
0 siblings, 1 reply; 7+ messages in thread
From: Burton, Ross @ 2013-10-10 15:09 UTC (permalink / raw)
To: Seth Bollinger; +Cc: Paul Eggleton, yocto@yoctoproject.org
On 10 October 2013 16:02, Seth Bollinger <seth.boll@gmail.com> wrote:
>> You need to use $D so that you're not attempting to write to the *host's*
>> /etc:
>>
>> echo test >> $D/etc/inittest2
>>
>> In a postinst $D may be set, and if it is then the postinst is being
>> ran on the host at rootfs time, and points to where the rootfs is
>> being constructed.
>
>
> Ok, I changed to as follows:
> pkg_postinst_${PN} () {
> echo "testtest" >> ${D}/etc/inittest
> }
>
> After that I do a find and the file is only populated in the recipe's image
> directory, not the rootfs.
Use $D instead of ${D}. ${D} will get expanded when the package is
created but you want to use the environment variable $D.
Ross
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Recipes that update a shared file
2013-10-10 15:09 ` Burton, Ross
@ 2013-10-10 15:17 ` Seth Bollinger
0 siblings, 0 replies; 7+ messages in thread
From: Seth Bollinger @ 2013-10-10 15:17 UTC (permalink / raw)
To: Burton, Ross; +Cc: Paul Eggleton, yocto@yoctoproject.org
[-- Attachment #1: Type: text/plain, Size: 339 bytes --]
On Thu, Oct 10, 2013 at 10:09 AM, Burton, Ross <ross.burton@intel.com>wrote:
> Use $D instead of ${D}. ${D} will get expanded when the package is
> created but you want to use the environment variable $D.
>
Looks like that worked! I apologize for missing the curly braces in your
previous response.
Thanks very much!
Seth
[-- Attachment #2: Type: text/html, Size: 696 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-10-10 15:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-10 0:16 Recipes that update a shared file seth bollinger
2013-10-10 9:31 ` Paul Eggleton
2013-10-10 14:36 ` Seth Bollinger
2013-10-10 14:40 ` Burton, Ross
2013-10-10 15:02 ` Seth Bollinger
2013-10-10 15:09 ` Burton, Ross
2013-10-10 15:17 ` Seth Bollinger
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.