From b2e83321e2e0c6a8950dcff66edd21118b06356e Mon Sep 17 00:00:00 2001 From: stornic56 <71296607+stornic56@users.noreply.github.com> Date: Thu, 7 May 2026 01:31:06 -0500 Subject: [PATCH] Add files via upload --- modules/extras.sh | 2 +- modules/kernel.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++ modules/utils.sh | 28 +++++++++++++-------- 3 files changed, 82 insertions(+), 11 deletions(-) create mode 100644 modules/kernel.sh diff --git a/modules/extras.sh b/modules/extras.sh index 6e0f873..1ec624c 100644 --- a/modules/extras.sh +++ b/modules/extras.sh @@ -21,7 +21,7 @@ install_extras() { "fetch" "System info (${fetch_pkg})" ON \ "cpufetch" "CPU info fetcher" ON \ "cpu-x" "CPU-X (GUI alternative to CPU-Z)" ON \ - "btop" "Resource monitor (fancy top)" ON \ + "btop" "Resource monitor (fancy top)" OFF \ "htop" "Interactive process viewer" ON \ "vlc" "VLC media player" ON \ "mpv" "Lightweight media player" OFF \ diff --git a/modules/kernel.sh b/modules/kernel.sh new file mode 100644 index 0000000..42c5c16 --- /dev/null +++ b/modules/kernel.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +# kernel.sh + +install_kernel_backports() { + echo -e "${YELLOW}Kernel from Backports${NC}" + + # Check if backports are enabled at system level + if [ "$(is_backports_enabled)" != "true" ]; then + echo -e "${YELLOW}Backports repository is not enabled.${NC}" + echo "Use option 2 (Configure repositories) to enable backports first." + return 1 + fi + + local backports_kernel_ver + backports_kernel_ver=$(get_backports_kernel_version) + + echo "This will install the latest stable kernel from backports." + echo " - Newer hardware support" + echo " - Potential performance improvements" + if [ "$backports_kernel_ver" != "unknown" ]; then + echo " - Kernel version available: $backports_kernel_ver" + else + echo " - Kernel version could not be determined at this time" + fi + echo "" + + # Extra warning if NVIDIA GPU is detected + if [ "$GPU_TYPE" == "nvidia" ]; then + echo -e "${RED}============================================${NC}" + echo -e "${RED} WARNING: NVIDIA GPU detected${NC}" + echo -e "${RED}============================================${NC}" + echo "Backports kernels (6.19+) can break the NVIDIA 550 driver." + echo "If you installed the NVIDIA driver earlier, this may cause" + echo "display issues or DKMS compilation failures." + echo "" + fi + + # Build the whiptail message dynamically + local msg + msg="Do you want to install the latest kernel from backports?\n\n" + if [ "$backports_kernel_ver" != "unknown" ]; then + msg+="Kernel version: $backports_kernel_ver\n\n" + fi + msg+="This replaces the current linux-image-amd64 metapackage.\n" + msg+="You can still boot older kernels from GRUB.\n" + + if [ "$GPU_TYPE" == "nvidia" ]; then + msg+="\n WARNING: NVIDIA GPU detected.\n" + msg+="Backports kernels (6.19+) may break the NVIDIA 550 driver.\n" + fi + + if ! whiptail --title "Install Kernel from Backports" \ + --yesno "$msg" 16 70; then + echo "Skipping kernel installation." + return + fi + + echo "Installing kernel from backports..." + sudo apt install -y -t "${DEBIAN_CODENAME}-backports" linux-image-amd64 + + echo -e "${GREEN}Kernel from backports installed.${NC}" + echo "Please reboot to use the new kernel." +} diff --git a/modules/utils.sh b/modules/utils.sh index 3819ca5..0fb37d2 100644 --- a/modules/utils.sh +++ b/modules/utils.sh @@ -150,16 +150,11 @@ get_intel_generation() { fi } -# --------------------------------------------- -# Check if backports repository is enabled -# --------------------------------------------- +# ---------------------------------------------------------------------- +# Check if backports repository is enabled (active line without #) +# ---------------------------------------------------------------------- is_backports_enabled() { - if [ "$REPOS_CONFIGURED" != true ]; then - echo false - return - fi - - # Check both classic and deb822 sources + # Check classic sources.list if [ -f /etc/apt/sources.list ]; then if grep -Eq '^[^#]*[ \t]+bookworm-backports[ \t]+' /etc/apt/sources.list 2>/dev/null; then echo true @@ -171,8 +166,9 @@ is_backports_enabled() { fi fi + # Check deb822 .sources files if [ -d /etc/apt/sources.list.d ]; then - if grep -qr 'backports' /etc/apt/sources.list.d/*.sources 2>/dev/null; then + if grep -qr 'Suites:.*-backports' /etc/apt/sources.list.d/*.sources 2>/dev/null; then echo true return fi @@ -180,3 +176,15 @@ is_backports_enabled() { echo false } + + +get_backports_kernel_version() { + local ver + ver=$(apt-cache policy linux-image-amd64 2>/dev/null | \ + grep -E '^[[:space:]]+[0-9]+\.[0-9]+\.[0-9]+.*~bpo' | head -n1 | awk '{print $1}') + if [ -n "$ver" ]; then + echo "$ver" + else + echo "unknown" + fi +}