diff -Nru initramfs-tools-0.122ubuntu8.12/debian/changelog initramfs-tools-0.122ubuntu8.13/debian/changelog --- initramfs-tools-0.122ubuntu8.12/debian/changelog 2018-05-16 22:10:19.000000000 +0200 +++ initramfs-tools-0.122ubuntu8.13/debian/changelog 2018-09-12 14:06:58.000000000 +0200 @@ -1,3 +1,10 @@ +initramfs-tools (0.122ubuntu8.13) xenial; urgency=medium + + * debian/initramfs-tools.postinst: remove orphaned old-dkms initrd files + in /boot. (LP: #1791959) + + -- Tiago Stürmer Daitx Wed, 12 Sep 2018 12:06:58 +0000 + initramfs-tools (0.122ubuntu8.12) xenial; urgency=medium [ Scott Moser ] diff -Nru initramfs-tools-0.122ubuntu8.12/debian/initramfs-tools.postinst initramfs-tools-0.122ubuntu8.13/debian/initramfs-tools.postinst --- initramfs-tools-0.122ubuntu8.12/debian/initramfs-tools.postinst 2016-12-09 18:41:30.000000000 +0100 +++ initramfs-tools-0.122ubuntu8.13/debian/initramfs-tools.postinst 2018-09-12 14:06:58.000000000 +0200 @@ -11,4 +11,21 @@ DPKG_MAINTSCRIPT_PACKAGE='' update-initramfs -u fi +# Remove all initrd old dkms files for which there is no +# corresponding initram image in /boot (LP: #1791959). +# One shot only: +# - bug only affected users that were upgrading packages +# - new users are not affected +# - LP: #1515513 took care of removing old dkms together with the kernel +if [ "x$1" = xconfigure ] && [ -n "$2" ] && dpkg --compare-versions "$2" lt "0.122ubuntu8.13"; then + for old_dkms_file in /boot/initrd-*.img.old-dkms \ + /boot/initramfs-*.img.old-dkms \ + /boot/initrd.img-*.old-dkms \ + /boot/initrd-*.old-dkms; do + if [ ! -e "${old_dkms_file%%.old-dkms}" ]; then + rm -fv "${old_dkms_file}" + fi + done +fi + #DEBHELPER#