Package: initramfs-tools
Severity: normal
X-Debug-CC: pkg-cryptsetup-devel@lists.alioth.debian.org
Dear Maintainer,
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.
3/ Make /usr/share/initramfs-tools/conf-hooks.d/$hook a symlink to
/etc/initramfs-tools/conf-hooks.d/$hook. But again, this uses an
undocumented property of mkinitramfs(8), and it might hijack your
/etc/initramfs-tools namespace.
There are packages that ship user configurable initramfs hooks
(cryptsetup and dropbear-initramfs come to mind). These package need
documented instructions for where to drop user configuration
(/etc/initramfs-tools/conf-hooks.d/$package comes to mind).
Alternatively, in a private discussion with Jonas Meurer of the Debian
Cryptsetup Team (X-Debug-CC), I've been suggested that mkinitramfs(8)
could instead source files in /etc/initramfs-tools/conf-hooks.d/ after
sourcing /usr/share/initramfs-tools/conf-hooks.d/. This way package
maintainers would ship variables with their default in /usr while users
would write their custom configuration in /etc.
-8<----------------------------------------------------->8-
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -87,6 +87,7 @@
echo "Warning: ${i} is a directory instead of file, ignoring."
elif [ -e "${i}" ]; then
. "${i}"
+ . [ ! -f "/etc/${i#/usr/share/}" ] || . "/etc/${i#/usr/share/}"
fi
done
-8<----------------------------------------------------->8-
Either way, IMHO initramfs-tools(8) should include some instructions for
custom initramfs hook configuration.
Cheers,
--
Guilhem.
PS. In fact I've implemented 3/ in dropbear-initramfs a couple of weeks
ago. Oops…
Attachment:
signature.asc
Description: PGP signature