From ba64ff3c1a2ec0984213f082b50d1d4232307e97 Mon Sep 17 00:00:00 2001 From: Xavier Petit <32063953+xpetit@users.noreply.github.com> Date: Thu, 12 Sep 2019 18:51:24 +0100 Subject: [PATCH] Remove outdated kernels --- scripts/install_client.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/install_client.sh b/scripts/install_client.sh index 59101a374..a344dcc24 100755 --- a/scripts/install_client.sh +++ b/scripts/install_client.sh @@ -28,6 +28,13 @@ apt-get update apt-get -y upgrade apt-get -y autoremove --purge +# Remove outdated kernels +old_kernels=$(ls -1 /boot/config-* | xargs -n1 basename | grep -v "$(uname -r)" | cut -d- -f2,3) + +for old_kernel in $old_kernels; do + dpkg -P $(dpkg-query -f '${binary:Package}\n' -W *"$old_kernel"*) +done + . bash_tweaks.sh . ssh.sh . firewall.sh