#!/bin/sh
-if [ -x /usr/sbin/update-initramfs ]
+case "$(ls -l /boot/vmlinuz* | wc -l)" in
+ 1)
+ # We only have one kernel installed, so we can use "-u"
+ # which will use dpkg-trigger inside update-initramfs
+ INITRAMFS_ARGS="-u"
+ ;;
+ *)
+ INITRAMFS_ARGS="-u -k all"
+ ;;
+esac
+
+if [ -x /usr/sbin/update-initramfs ] && [ "x$1" != "xtriggered" ] && \
+ dpkg --compare-versions "$DPKG_RUNNING_VERSION" ge '1.14.18'
then
- update-initramfs -k all -u
+ # this activates the trigger, if triggers are working
+ update-initramfs ${INITRAMFS_ARGS}
+else
+ # force it to actually happen
+ DPKG_MAINTSCRIPT_PACKAGE='' update-initramfs ${INITRAMFS_ARGS}
fi
#DEBHELPER#