Files
debianito-post-install/modules/gpu/nvidia_manage.sh
T
stornic56 0e24e8f9ae System-Wide Refactor & Critical Fixes
- Resolved NVIDIA driver management issues by expanding package detection patterns (including nvidia-open and nvidia-kernel-open-dkms), enhancing purge process to ensure clean uninstallation of v590/595 drivers, and adding conditional skip for manage menu when no driver is installed.  
- Enhanced Firefox variant selection in internet.sh using exact token matching (grep -qx) instead of substring search to prevent incorrect removal or unintended ESR/Firefox conflicts. 
- New XFCE install option with 4 options
- Restructured Desktop Environment into two-level menu system with dispatcher and Xfce sub-menu for scalability, enabling future additions like GNOME/KDE without disrupting existing flows.  
- Added Polkit rules in desktop_display.sh to grant suspend permissions without password prompts on laptops, including idempotent group (backlight) creation and user membership management with || true fallbacks.  
- Enforced LC_ALL=C LANGUAGE=C environment variables for all dpkg-reconfigure commands across System Preferences and utils.sh to ensure native dialogues run consistently in English.  
- Fixed kernel backports menu option availability to only appear on Debian 13, preventing errors on Debian 12 where backports repositories are EOL.  
- Improved ZRAM module initialization sequence by ensuring swapoff and zram module removal occur before writing new configuration files to prevent race conditions during system setup.
2026-08-17 23:50:39 -05:00

61 lines
2.1 KiB
Bash

#!/usr/bin/env bash
# nvidia_manage.sh — NVIDIA management menu: install/change or remove
_nvidia_driver_installed() {
dpkg -l 2>/dev/null | grep -qE "^ii (nvidia-driver|nvidia-tesla-470-driver|nvidia-open|nvidia-kernel-dkms|nvidia-kernel-open-dkms|nvidia-open-kernel-dkms)"
}
_nvidia_manage_menu() {
local choice
choice=$(_menu "NVIDIA Driver" "Manage NVIDIA Driver" 12 70 4 \
"1" "Install / Change NVIDIA Driver Version" \
"2" "Remove NVIDIA Driver and Restore Nouveau")
[ -z "$choice" ] && {
echo "Skipping NVIDIA installation."
return 1
}
case "$choice" in
2)
_nvidia_remove
return 1
;;
*) return 0 ;;
esac
}
_nvidia_remove() {
if ! _nvidia_driver_installed; then
echo -e "${YELLOW}NVIDIA driver is not installed on this system.${NC}"
return 0
fi
if ! _confirm "Remove NVIDIA" "This will:\n - Purge the NVIDIA driver packages\n - Remove script-generated configs\n - Remove the CUDA repo sources\n - Regenerate initramfs\n\nProceed?"; then
echo "NVIDIA removal cancelled."
return 0
fi
echo "Removing NVIDIA driver packages..."
sudo apt purge -y nvidia-driver nvidia-kernel-dkms nvidia-open-kernel-dkms nvidia-open nvidia-kernel-open-dkms nvidia-tesla-470-driver nvidia-settings nvidia-vaapi-driver firmware-nvidia-gsp mesa-vdpau-drivers nvidia-driver-pinning-* || true
echo "Cleaning up dependencies..."
sudo apt autoremove --purge -y || true
echo "Removing script-generated configuration..."
sudo rm -f /etc/modprobe.d/nvidia-wayland.conf || true
sudo rm -f /etc/modprobe.d/nvidia-open.conf || true
sudo rm -f /etc/apt/preferences.d/block-nvidia || true
sudo rm -f /etc/X11/xorg.conf.d/20-nvidia.conf || true
echo "Removing NVIDIA repository sources..."
sudo rm -f /etc/apt/sources.list.d/cuda-*.list || true
sudo rm -f /etc/apt/sources.list.d/extrepo_nvidia-cuda.sources || true
echo "Regenerating initramfs..."
sudo update-initramfs -u || true
echo -e "${GREEN}NVIDIA driver removed. Please reboot your system.${NC}"
return 0
}