From 3649eec285c2ae90ab0421bdca78811309bcb9ef Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Mon, 28 Nov 2016 11:26:30 -0600 Subject: [PATCH] * usr/bin/purge-old-kernels: - ensure that we keep the current running kernel --- debian/changelog | 2 ++ usr/bin/purge-old-kernels | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index e8f14798..f5a745ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,8 @@ byobu (5.113) unreleased; urgency=medium - when selecting a session, if only empty sessions exist, then create a new one; the bug was that tmux considers a null string argument still an argument + * usr/bin/purge-old-kernels: + - ensure that we keep the current running kernel -- Dustin Kirkland Fri, 16 Sep 2016 10:13:08 -0500 diff --git a/usr/bin/purge-old-kernels b/usr/bin/purge-old-kernels index 90e6a233..8fd6c271 100755 --- a/usr/bin/purge-old-kernels +++ b/usr/bin/purge-old-kernels @@ -44,8 +44,9 @@ while [ ! -z "$1" ]; do esac done -# Build our list of kernel packages to purge -VERSIONS=$(ls -f /boot/vmlinuz-* | sed -e "s/[^\-]*-//" -e "s/-[^\-]*$//" | sort -rh) +# Build our list of kernel packages to purge, make sure we exclude the current running kernel +current="$(uname -r)" +VERSIONS=$(ls -f /boot/vmlinuz-* | grep -v "$current$" | sed -e "s/[^\-]*-//" -e "s/-[^\-]*$//" | sort -rh) count=0 for v in $VERSIONS; do count=$((count+1))