[yocto] Recipes that update a shared file

Burton, Ross ross.burton at intel.com
Thu Oct 10 07:40:43 PDT 2013


On 10 October 2013 15:36, Seth Bollinger <seth.boll at 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



More information about the yocto mailing list