Which reasons could make Yocto nginx post installation script not run on target?

I’m building a Kirkstone Yocto distro, running with systemd and using the nginx recipe from meta-openembedded/meta-webserver/recipes-httpd (this version).

I thought that the nginx package post-installation script would be launched on target, so that the if [ -z "$D" ] (line 151 in nginx.inc recipe file) would be entered and the tmp files (/run/nginx and /var/log/nginx from nginx-volatile.conf file) would be created by systemd-tmpfile --create. But the script was only executed on host during the build process.

To get the tmp files created on target by the post-installation script, I had to replace in the nginx.inc file (line 151):
pkg_postinst:${PN} () {
by
pkg_postinst_ontarget:${PN} () {

Sure I misunderstood something because otherwise everybody would have the same behavior as me.
But I didn’t manage to find the root cause.

Any advice would be welcome, thanks in advance for your help.

Read more here: Source link