diff --git a/debian/changelog b/debian/changelog index ecfd53c5..6e174158 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,9 @@ byobu (5.110) unreleased; urgency=medium - fix DISTRO to BYOBU_DISTRO in template * debian/control: LP: #1596364 - add |xterm to suggests + * usr/bin/purge-old-kernels: LP: #1595977 + - modify the kernel purge algorithm slightly to better handle efi + and virtual kernels -- Dustin Kirkland Tue, 05 Jul 2016 10:47:25 -0500 diff --git a/usr/bin/purge-old-kernels b/usr/bin/purge-old-kernels index b2d1e28e..87e2c5c8 100755 --- a/usr/bin/purge-old-kernels +++ b/usr/bin/purge-old-kernels @@ -45,9 +45,18 @@ while [ ! -z "$1" ]; do done # Build our list of kernel packages to purge -CANDIDATES=$(ls -tr /boot/vmlinuz-* | head -n -${KEEP} | grep -v "$(uname -r)$" | cut -d- -f2- | awk '{print "linux-image-" $0 " linux-headers-" $0}' ) -for c in $CANDIDATES; do - dpkg-query -s "$c" >/dev/null 2>&1 && PURGE="$PURGE $c" +VERSIONS=$(ls -f /boot/vmlinuz-* | sed -e "s/[^\-]*-//" -e "s/-[^\-]*$//" | sort -rh) +count=0 +for v in $VERSIONS; do + count=$((count+1)) + if [ $count -le $KEEP ]; then + continue + fi + for k in linux-image linux-headers linux-signed-image linux-image-virtual; do + for f in generic lowlatency; do + dpkg-query -s "$k-$v-$f" >/dev/null 2>&1 && PURGE="$PURGE $k-$v-$f" + done + done done if [ -z "$PURGE" ]; then