imagebuilder: add hostpkgs to imagebuilder
Before this commit, host packages were not installed into the imagebuilder. This made it impossible to make use of hostpkgs in opkg postinstall scripts in combination with the imagebuilder.
This commit changes this and ensures, that
- staging_dir/hostpkg/bin/* is installed to the imagebuilder.
- staging_dir/hostpkg/lib/lua is installed into the imagebuilder (if existing).
- Dependencies of lua libraries are installed into staging_dir/hostpkg/lib using bundle-libraries.sh.
After this commit, we are able to use hostpkgs (like lua) in opkg postinstall scripts in combination with the imagebuilder, assuming that those packages built as hostpkgs anyways.
With default OpenWrt configuration for x86-64, the unpacked imagebuilder becomes this much larger:
1.5M staging_dir/hostpkg/bin
3.6M staging_dir/hostpkg/lib
Signed-off-by: Leonardo Mörlein [email protected]
(EDIT: Updated to new commit message.)
A test of (the newest version of) this PR is still compiling. I'll inform you when this is finished.
CC: @aparcar
Hi, @lemoer, thanks for your contribution. Could you please provide an example package which uses Lua postinstall scripts?
Hi @aparcar,
thank you for picking this up.
Packages that use Lua postinstall scripts exist within gluon (for quite some time).
Explanation: To make it short, we have an additional build configuration file (called site.conf), where users of the build framework can customize the created router images. To ensure the creation of valid router images, this config has to be verified. The verification is done in a opkg postinstall script, since the validity of this config depends on the installed packages. Some packages require options in the config, which others do not. Therefore, we put a (lua) config verification script into the postinstall section of each package, which then checks the site.conf options it relies on.
If desired, I can share additional information about this approach.
Do you have an estimation how much bigger the imagebuilder becomes?
With default OpenWrt configuration for x86-64:
~/d/f/i/2/openwrt-imagebuilder-x86-64.Linux-x86_64> du -sh staging_dir/hostpkg/{bin,lib}
1.5M staging_dir/hostpkg/bin
3.6M staging_dir/hostpkg/lib
I updated this patch once more. Now *.so dependencies of lua libraries are also bundled correctly in the imagebuilder.
@aparcar is the size increase acceptable?
this seems sensible.
Please explain the need to change bundle-libraries.sh.