diff mbox

deb-pkg: Inhibit initramfs builders if CONFIG_BLK_DEV_INITRD is not set

Message ID 1384484605.2771.13.camel@deadeye.wl.decadent.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Hutchings Nov. 15, 2013, 3:03 a.m. UTC
The kernel postinst hook for initramfs-tools will build an initramfs
on installation unless $INITRD is set to 'No'.  make-kpkg generates a
postinst script that sets this variable appropriately, but we don't.
Set it based on CONFIG_BLK_DEV_INITRD.

This should also work with dracut when <http://bugs.debian.org/729622>
is fixed.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 scripts/package/builddeb | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Comments

Michal Marek Nov. 18, 2013, 2:09 p.m. UTC | #1
On Fri, Nov 15, 2013 at 03:03:25AM +0000, Ben Hutchings wrote:
> The kernel postinst hook for initramfs-tools will build an initramfs
> on installation unless $INITRD is set to 'No'.  make-kpkg generates a
> postinst script that sets this variable appropriately, but we don't.
> Set it based on CONFIG_BLK_DEV_INITRD.
> 
> This should also work with dracut when <http://bugs.debian.org/729622>
> is fixed.
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---

Applied to kbuild.git#misc, thanks.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 90e521f..65014e1 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -172,8 +172,15 @@  fi
 
 # Install the maintainer scripts
 # Note: hook scripts under /etc/kernel are also executed by official Debian
-# kernel packages, as well as kernel packages built using make-kpkg
+# kernel packages, as well as kernel packages built using make-kpkg.
+# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and
+# so do we; recent versions of dracut and initramfs-tools will obey this.
 debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
+if grep -q '^CONFIG_BLK_DEV_INITRD=y' $KCONFIG_CONFIG; then
+	want_initrd=Yes
+else
+	want_initrd=No
+fi
 for script in postinst postrm preinst prerm ; do
 	mkdir -p "$tmpdir$debhookdir/$script.d"
 	cat <<EOF > "$tmpdir/DEBIAN/$script"
@@ -184,6 +191,9 @@  set -e
 # Pass maintainer script parameters to hook scripts
 export DEB_MAINT_PARAMS="\$*"
 
+# Tell initramfs builder whether it's wanted
+export INITRD=$want_initrd
+
 test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
 exit 0
 EOF