[pkg-cryptsetup-devel] initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration

Ben Hutchings ben at decadent.org.uk
Fri Dec 11 00:54:03 UTC 2015


On Thu, 2015-12-10 at 12:15 +0100, Jonas Meurer wrote:
> Hi there,
> 
> On Thu, 10 Dec 2015 02:52:11 +0100 Guilhem Moulin 
> wrote:
> > AFAIK there is no documentation for where users should set variables to
> > configure an initramfs hook.  There are a couple of workaround, all
> > hacky and/or relying on undocumented properties of initramfs-tools(8):
> > 
> >   1/ Setting said variable in initramfs.conf(5).  (Since hook scripts
> >      are executed is sub-shells the variable need to be exported.)  This
> >      is somewhat ugly since initramfs.conf(5) is the configuration file
> >      *for mkinitramfs*, not for the hook files.
> > 
> >   2/ Using /usr/share/initramfs-tools/conf-hooks.d/$hook.  This is an
> >      undocumented (short of an entry in the changelog) hack.  Also
> >      unless that file is marked as a conffile (which violates the
> >      policy) user modifications are wiped upon upgrade.
> 
> If I got it right (didn't find documentation about it), the current
> purpose of conf-hooks.d seems to be to configure *mkinitramfs* in a
> proper way required by the hook scripts, not to set configuration
> variables for the hook scripts themselves, no?

The only documentation I'm aware of is in the changelog:

  * mkinitramfs: Export MODULES, allows hook scripts to act accordingly.
    (closes: #421658) Add /usr/share/initramfs-tools/conf-hooks.d for hooks
    options on mkinitramfs run. Do not land in initramfs.

[...]
> - redefine the purpose of files in conf-hooks.d to set variables that
>   are made available to mkinitramfs *and* the hook scripts. In other
>   words, parse the configure includes from conf-hooks.d in mkinitramfs
>   and export all variables instead of just sourcing the files.
[...]

No, I am not going to add any more half-baked shell script parsing.

Also, it doesn't make any sense to me, to put hook-specific
configuration into a namespace shared across all hooks.  You can
always add a configuration file to your own package and source it in
your hook script.

Ben.

-- 
Ben Hutchings
One of the nice things about standards is that there are so many of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-cryptsetup-devel/attachments/20151211/7c63ef0c/attachment.sig>


More information about the pkg-cryptsetup-devel mailing list