new file mode 100644
@@ -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
@@ -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
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