From 99605baaf2ec7c6a35583b201c297979e2314cf5 Mon Sep 17 00:00:00 2001 From: tteckster Date: Sat, 16 Apr 2022 07:40:15 -0400 Subject: [PATCH] Update kernel-clean.sh --- misc/kernel-clean.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/misc/kernel-clean.sh b/misc/kernel-clean.sh index 9f534d1c..9a883003 100644 --- a/misc/kernel-clean.sh +++ b/misc/kernel-clean.sh @@ -46,32 +46,32 @@ function kernel_info() { echo -e "${GN}Latest Kernel: $latest_kernel\n${CL}" fi else - echo -e "\n${RD}ERROR: No PVE Kernel found\n${CL}" + echo -e "\n${RD}ERROR: No PVE Kernel Found\n${CL}" exit 1 fi } function kernel_clean() { kernels=$(dpkg --list| grep 'kernel-.*-pve' | awk '{print $2}' | sort -V) - kernels_to_remove="" + remove_kernels="" for kernel in $kernels do if [ "$(echo $kernel | grep $current_kernel)" ]; then break else - echo -e "${RD}'$kernel' ${CL}${LYW}has been added to the Kernel remove list\n${CL}" - kernels_to_remove+=" $kernel" + echo -e "${RD}'$kernel' ${CL}${LYW}has been added to the remove Kernel list\n${CL}" + remove_kernels+=" $kernel" fi done echo -e "${LYW}Kernel Search Complete!\n${CL}" - if [[ "$kernels_to_remove" != *"pve"* ]]; then + if [[ "$remove_kernels" != *"pve"* ]]; then echo -e "${BRT}${GN}It appears there are no old Kernels on your system. \n${CL}" else - read -p "${LYW}Would you like to remove the${RD} $(echo $kernels_to_remove | awk '{print NF}') ${CL}${LYW}selected Kernels listed above? [y/n]: ${CL}" -n 1 -r + read -p "${LYW}Would you like to remove the${RD} $(echo $remove_kernels | awk '{print NF}') ${CL}${LYW}selected Kernels listed above? [y/n]: ${CL}" -n 1 -r fi if [[ $REPLY =~ ^[Yy]$ ]]; then - echo -e "${LYW}\nRemoving ${CL}${RD}$(echo $kernels_to_remove | awk '{print NF}') ${CL}${LYW}old Kernels...${CL}" - /usr/bin/apt purge -y $kernels_to_remove > /dev/null 2>&1 + echo -e "${LYW}\nRemoving ${CL}${RD}$(echo $remove_kernels | awk '{print NF}') ${CL}${LYW}old Kernels...${CL}" + /usr/bin/apt purge -y $remove_kernels > /dev/null 2>&1 echo -e "${LYW}Finished!\n${CL}" echo -e "${LYW}Updating GRUB... \n${CL}" /usr/sbin/update-grub > /dev/null 2>&1