diff --git a/debian/changelog b/debian/changelog index 49966b0f1..61c4aca20 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,8 @@ linux (4.6-1~exp3) UNRELEASED; urgency=medium for minimal_swap, no_symlinks, use_hard_links and *_hook parameters in /etc/kernel-img.conf (Closes: #730073). * linux-image: postrm: Update default symlinks before running hook scripts + * linux-image: Make a newly installed kernel the default if the package + was previously removed -- Ben Hutchings Sat, 04 Jun 2016 18:33:11 +0100 diff --git a/debian/templates/image.postinst.in b/debian/templates/image.postinst.in index 09960b85e..ebd17df89 100755 --- a/debian/templates/image.postinst.in +++ b/debian/templates/image.postinst.in @@ -13,12 +13,13 @@ fi depmod $version -if [ -z "$2" ]; then +if [ -f /lib/modules/$version/.fresh-install ]; then change=install else change=upgrade fi linux-update-symlinks $change $version $image_path +rm -f /lib/modules/$version/.fresh-install if [ -d /etc/kernel/postinst.d ]; then DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \ diff --git a/debian/templates/image.postrm.in b/debian/templates/image.postrm.in index 9ba8546bd..29e9c8250 100755 --- a/debian/templates/image.postrm.in +++ b/debian/templates/image.postrm.in @@ -3,6 +3,8 @@ version=@abiname@@localversion@ image_path=/boot/@image-stem@-$version +rm -f /lib/modules/$version/.fresh-install + if [ "$1" != upgrade ] && command -v linux-update-symlinks >/dev/null; then linux-update-symlinks remove $version $image_path fi diff --git a/debian/templates/image.preinst.in b/debian/templates/image.preinst.in index e723bed03..8a5658ecd 100755 --- a/debian/templates/image.preinst.in +++ b/debian/templates/image.preinst.in @@ -7,6 +7,12 @@ if [ "$1" = abort-upgrade ]; then exit 0 fi +if [ "$1" = install ]; then + # Create a flag file for postinst + mkdir -p /lib/modules/$version + touch /lib/modules/$version/.fresh-install +fi + if [ -d /etc/kernel/preinst.d ]; then DEB_MAINT_PARAMS="$*" run-parts --report --exit-on-error --arg=$version \ --arg=$image_path /etc/kernel/preinst.d