Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.bugs.dist > #699860

Bug#807527: initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration

From Guilhem Moulin <guilhem@guilhem.org>
Newsgroups linux.debian.bugs.dist, linux.debian.kernel
Subject Bug#807527: initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration
Date 2015-12-10 03:00 +0100
Message-ID <qDYGu-7Sr-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Cross-posted to 2 groups.

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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…

Back to linux.debian.bugs.dist | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Bug#807527: initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration Guilhem Moulin <guilhem@guilhem.org> - 2015-12-10 03:00 +0100
  Bug#807527: initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration Guilhem Moulin <guilhem@guilhem.org> - 2015-12-10 03:40 +0100
  Bug#807527: initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration Jonas Meurer <jonas@freesources.org> - 2015-12-10 13:00 +0100
    Bug#807527: initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration Guilhem Moulin <guilhem@guilhem.org> - 2015-12-10 15:30 +0100
      Bug#807527: initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration Jonas Meurer <jonas@freesources.org> - 2015-12-10 16:20 +0100
    Bug#807527: initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration Ben Hutchings <ben@decadent.org.uk> - 2015-12-11 02:00 +0100
      Bug#807527: initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration Guilhem Moulin <guilhem@guilhem.org> - 2015-12-11 15:40 +0100
        Bug#807527: initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration Jonas Meurer <jonas@freesources.org> - 2015-12-17 10:10 +0100
          Bug#807527: [pkg-cryptsetup-devel] initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration Jonas Meurer <jonas@freesources.org> - 2015-12-23 23:20 +0100
            Bug#807527: [pkg-cryptsetup-devel] initramfs-tools: Please provide an API or best practices for custom initramfs hook configuration Jonas Meurer <jonas@freesources.org> - 2015-12-25 15:00 +0100

csiph-web