[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#600937: Please disable /etc/kernel postinst hook if the target kernel is non-modular



Package: initramfs-tools
Version: 0.98.4
Severity: minor
Tags: patch

If I try to install a non-modular kernel
/etc/kernel/postinst.d/initramfs-tools tries to build an initrd image
and fails, because no modules are found. Please apply the attached patch
(or a similar one) to disable it for that case.

Thanks,

Guido
>From 9f638f2eabb49da543ca153f6649601630c7f478 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@debian.org>
Date: Thu, 21 Oct 2010 16:58:53 +0100
Subject: [PATCH] Don't try build initramfs on non-modular kernel

If the kernel is build without modules support (for example for a
virtual machine) then there's no point in trying to build an initrd
image.

Signed-off-by: Guido Trotter <ultrotter@debian.org>
---
 kernel/postinst.d/initramfs-tools |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/kernel/postinst.d/initramfs-tools b/kernel/postinst.d/initramfs-tools
index d4db23d..d820a55 100755
--- a/kernel/postinst.d/initramfs-tools
+++ b/kernel/postinst.d/initramfs-tools
@@ -27,5 +27,12 @@ if [ -n "$DEB_MAINT_PARAMS" ]; then
 	fi
 fi
 
+# don't run on a non-modular kernel
+if [ -f "/boot/config-$version" ]; then
+	if grep -vq "CONFIG_MODULES=y" /boot/config-$version; then
+		exit 0
+	fi
+fi
+
 # we're good - create initramfs.  update runs do_bootloader
 update-initramfs -c -t -k "${version}" ${bootopt} >&2
-- 
1.7.1


Reply to: