diff mbox

[trusty,1/1] UBUNTU: [Config] linux-image-extra is additive to linux-image

Message ID 1412283910-31125-2-git-send-email-apw@canonical.com
State New
Headers show

Commit Message

Andy Whitcroft Oct. 2, 2014, 9:05 p.m. UTC
linux-image-extra is special, it is only additive to linux-image, this
means really cannot use the standard kernel postinst/postrm for this
package.  As it also depends on linux-image we know that linux-image will
have been installed before it, and will be removed after it.  On change
(installation/update/removal) of linux-image-extra we want to run the
kernel postinst to rebuilt the initramfs and update the bootloader
as necessary.  To this end switch to package specific postinst/postrm
which trigger the /etc/kernel/postinst.d hooks.  We need to do it this
way to get the specially parameterised incantations of update-initramfs,
to ensure we trigger the correct build rather than mearly dpkg triggering
a rebuild of the running kernel.

BugLink: http://bugs.launchpad.net/bugs/1375310
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 debian/control-scripts/extra-post | 14 ++++++++++++++
 debian/rules.d/2-binary-arch.mk   |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)
 create mode 100644 debian/control-scripts/extra-post

Comments

Tim Gardner Oct. 3, 2014, 9:56 p.m. UTC | #1
Nice solution. I had been headed down a completely different path.
diff mbox

Patch

diff --git a/debian/control-scripts/extra-post b/debian/control-scripts/extra-post
new file mode 100644
index 0000000..a0c78af
--- /dev/null
+++ b/debian/control-scripts/extra-post
@@ -0,0 +1,14 @@ 
+#!/bin/sh
+set -e
+
+case "$0::$1" in
+*.postinst::configure|*.postrm::remove|*.postrm::purge)
+	depmod -a -F /boot/System.map-=V =V || true
+	for dir in "/etc/kernel/postinst.d" "/etc/kernel/postinst.d/=V"
+	do
+		if [ -d "$dir" ]; then
+			run-parts --verbose --exit-on-error --arg="=V" --arg="/boot/=K-=V" "$dir"
+		fi
+	done
+	;;
+esac
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 4b43d2f..223186f 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -173,7 +173,7 @@  ifeq ($(do_extras_package),true)
 		for script in postinst postrm ; do				\
 			sed -e 's/=V/$(abi_release)-$*/g' -e 's/=K/$(instfile)/g'		\
 			    -e 's/=L/$(loader)/g'         -e 's@=B@$(build_arch)@g'		\
-			    debian/control-scripts/$$script > $(pkgdir_ex)/DEBIAN/$$script; \
+			    debian/control-scripts/extra-post > $(pkgdir_ex)/DEBIAN/$$script; \
 			chmod 755 $(pkgdir_ex)/DEBIAN/$$script;			\
 		done;								\
 	fi