read -p "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed(y/n)?" yn
case$yn in
[Yy]*)break;;
[Nn]*)exit;;
*)echo -e "${RD}Please answer y/n${CL}";;
esac
done
clear
function msg_info(){
function msg_info(){
localmsg="$1"
localmsg="$1"
echo -ne "${HOLD}${YW}${msg}..."
echo -ne "${HOLD}${YW}${msg}..."
@ -51,90 +37,34 @@ function msg_ok() {
echo -e "${BFR}${CM}${GN}${msg}${CL}"
echo -e "${BFR}${CM}${GN}${msg}${CL}"
}
}
function check_root(){
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE Kernel Clean" --yesno "This will Clean Unused Kernel Images, USE AT YOUR OWN RISK. Proceed?"1068|| exit
if[[$EUID -ne 0]];then
echo -e "${CROSS}${RD}Error: This script must be ran as the root user.\n${CL}"
echo -e "\nThe script cannot be used when running opt-in kernels. \nProxmox VE's package management relies directly on the current default kernel, which is 5.15. \nTherefore, it is not possible to utilize this script. In this case, you should use autoremove instead. \n`apt-get autoremove`\n"
whiptail --backtitle "Proxmox VE Helper Scripts" --title "No Other Kernels" --msgbox "It appears there are no old Kernels on your system. \nCurrent kernel ($current_kernel)."1068
remove_kernels=""
for kernel in $kernels;do
if["$(echo$kernel| grep $current_kernel)"];then
break
else
echo -e "${BL}'$kernel' ${CL}${YW}has been added to the remove Kernel list\n${CL}"
remove_kernels+="$kernel"
fi
done
msg_ok "Kernel Search Completed\n"
if[["$remove_kernels" != *"pve"* ]];then
echo -e "${PARTY}${GN}It appears there are no old Kernels on your system. \n${CL}"
msg_info "Exiting"
msg_info "Exiting"
sleep 2
sleep 2
msg_ok "Done"
msg_ok "Done"
else
exit
read -p "Would you like to remove the $(echo$remove_kernels| awk '{print NF}') selected Kernels listed above? [y/n]: " -n 1 -r
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Remove Kernels" --yesno "Would you like to remove the selected Kernels\n $remove_kernels\n Proceed?"1068|| exit