initdb and usrmerge-style systems
I'm using apk-tools as a downstream in https://chimera-linux.org. It works quite well, I've been able to deal with most aspects of the package manager (not yet sure about apk3 though; going to do the migration as soon as that goes stable). There is just one thing, and that is the --initdb
option for initializing fresh roots.
Chimera has a usrmerge-style layout, i.e. /lib
is a symlink to /usr/lib
and so on. That means if you use --initdb
and it populates the intial structure, it will create lib
in the root as a directory (https://gitlab.alpinelinux.org/alpine/apk-tools/-/blob/50ab589e/src/database.c#L1341) and once one of the base packages (base-files
, it is installed first, before everything else) attempts to install the symlink, it all goes wrong.
What I do for now is avoid --initdb
and populate the structure manually (the package build system does that internally, and for installing systems i have a special root bootstrap script similar to the likes of debootstrap). I'm not completely happy about having to do that though, so I'm looking for potential solutions. Something like a pre-install script that would fix it up would not work since at the point the package is extracted, a script environment is not available yet, and also I would like to avoid having to run any hooks or triggers for all dependencies of the minimal root metapackage (for robustness)