Image builder and postinst scripts

Hi,

I'm using image builder (openwrt-imagebuilder-23.05.2-bcm27xx-bcm2711.Linux-x86_64.tar.xz) inside docker (debian:stable-slim, non root user) to create an image, which so far works very good.

However it seems that the postinst scripts of the packages are executed inside the target environment (with IPKG_INSTROOT set to ../target/...etc), and some init scripts fail as there is no procd running and so on.

The question is
a) are the postinst files supposed to run during the image builder phase? Or should that be deferred to after the first boot?
b) whats the best practice here - check if IPKG_INSTROOT is set and in that case skip calls to procd?

Thank you very much

Moritz

1 Like

Do you mean your own custom packages or packages from OpenWrt repo?

AFAIK packages from the OpenWrt packages repo usually do check for IPKG_INSTROOT, for example: https://github.com/openwrt/packages/blob/643e501c8d0209dbbc683447b4df0c4b2b9aed08/net/pbr/Makefile#L117-L128

Ah, thank you very much!

In that case if there is anything that needs to get executed on the machine after installation one would just create a /etc/uci-defaults file?

I'm not sure I grasped your question, so... yes? :wink:

Be careful with uci-defaults scripts in packages -- follow code from packages repo, make sure to consider reinstalls of the same package.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.