From cbfdcd58155d6205e6df4a82a25e51aa0f406754 Mon Sep 17 00:00:00 2001 From: Tommy Miland Date: Sun, 25 Aug 2024 12:57:59 +0200 Subject: [PATCH] Add pkg check for uninstall mode - Added pkg check for uninstall mode --- kernel_installer.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel_installer.sh b/kernel_installer.sh index a428e0f..439f50d 100755 --- a/kernel_installer.sh +++ b/kernel_installer.sh @@ -996,7 +996,12 @@ install_kernel() { chk_permissions # Uninstall kernel if [ "$mode" = "uninstall" ]; then - apt remove linux-{image,headers}-"${LINUX_VER}" + if dpkg -s linux-headers-"${LINUX_VER}" >/dev/null 2>&1; then + apt purge linux-headers-"${LINUX_VER}" + exit + elif dpkg -s linux-image-"${LINUX_VER}" >/dev/null 2>&1; then + apt purge linux-image-"${LINUX_VER}" + fi exit fi