mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-09-14 06:02:35 +00:00
nvidia driver stability & version menu
- Refactored NVIDIA installation with robust DKMS verification (`_verify_nvidia_dkms_build`). Automatically detects build failures for the current kernel and repairs them via `dpkg-reconfigure`, ensuring modules compile against active kernels without manual intervention.
- Added Secure Boot detection (`_nvidia_secure_boot_enabled`) to warn users if the NVIDIA module is compiled but unsigned, preventing boot issues on systems with UEFI security enabled.
- Implemented `_configure_nvidia_wayland()` for Wayland support. Detects hybrid laptops (Optimus) vs desktops using DMI chassis types and battery presence. Configures `NVreg_PreserveVideoMemoryAllocations` only for desktops to avoid Optimus conflicts, and adds architecture-specific guards (e.g., Kepler warnings).
- Introduced version selection menu (`_show_nvidia_version_menu`). Users can select driver versions (470/535/550/590/595) based on Debian release. Parametrized CUDA repo installation for 590/595 with post-install DKMS branch verification.
- Fixed state inconsistency bugs in `NVIDIA_DRIVER_MODE`. Added guards to ensure configuration files are only written upon successful installation, preventing partial setups after failures (e.g., backports, CUDA repo).
- Improved hardware detection helpers (`_is_hybrid_laptop`, `_get_nvidia_arch_family`). Prevents false positives on multi-GPU desktops by verifying iGPU presence alongside dGPU.
- Updated Java/Minecraft support in `modules/extras/java.sh`. Added Temurin 25 ("Minecraft 26+") to the runtime selection menu and updated documentation.
- Enhanced utility robustness (`_run_cmd`, `_configure_lightdm`). Properly propagates exit codes from commands and handles failures gracefully (yellow warnings + skip) instead of crashing under `set -e`.
This commit is contained in:
@@ -23,6 +23,7 @@ declare -A NVIDIA_FAMILY_MAP=(
|
||||
)
|
||||
|
||||
detect_nvidia_arch() {
|
||||
[ -z "$1" ] && { echo "unknown"; return; }
|
||||
local pci_id="${1^^}"
|
||||
local prefix="${pci_id:0:2}"
|
||||
echo "${NVIDIA_FAMILY_MAP[$prefix]:-unknown}"
|
||||
@@ -39,6 +40,22 @@ _is_nvidia_kepler_id() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# Normaliza la familia de arquitectura NVIDIA desambiguando Kepler/Fermi
|
||||
# (detect_nvidia_arch los agrupa como "legacy" vía rango de device IDs)
|
||||
_get_nvidia_arch_family() {
|
||||
local fam
|
||||
fam=$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")
|
||||
if [ "$fam" = "legacy" ]; then
|
||||
if _is_nvidia_kepler_id "$NVIDIA_GPU_DEVICE_ID"; then
|
||||
echo "kepler"
|
||||
else
|
||||
echo "fermi"
|
||||
fi
|
||||
else
|
||||
echo "$fam"
|
||||
fi
|
||||
}
|
||||
|
||||
is_nvidia_kepler() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "legacy" ]] && _is_nvidia_kepler_id "$NVIDIA_GPU_DEVICE_ID" && echo true || echo false; }
|
||||
is_nvidia_fermi() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "legacy" ]] && ! _is_nvidia_kepler_id "$NVIDIA_GPU_DEVICE_ID" && echo true || echo false; }
|
||||
is_nvidia_legacy() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "legacy" ]] && echo true || echo false; }
|
||||
@@ -156,3 +173,22 @@ offer_generic_tools() {
|
||||
echo "Skipping GPU monitoring tools."
|
||||
fi
|
||||
}
|
||||
|
||||
_is_hybrid_laptop() {
|
||||
local gpu_count nvidia_count chassis
|
||||
gpu_count=$(lspci -nn 2>/dev/null | grep -ciE "VGA compatible|3D controller") || true
|
||||
[ "$gpu_count" -lt 2 ] && return 1
|
||||
|
||||
# Defensa en profundidad: si TODAS las GPUs son NVIDIA (SLI o
|
||||
# dual-GPU desktop), no hay iGPU Intel/AMD → no es híbrida.
|
||||
nvidia_count=$(lspci -nn 2>/dev/null | grep -iE "VGA compatible|3D controller" | grep -c "10de:") || true
|
||||
[ "$nvidia_count" -ge "$gpu_count" ] && return 1
|
||||
|
||||
chassis=$(cat /sys/class/dmi/id/chassis_type 2>/dev/null || echo "0")
|
||||
case "$chassis" in
|
||||
8|9|10|11|14|30|31|32) return 0 ;;
|
||||
esac
|
||||
|
||||
ls /sys/class/power_supply/ 2>/dev/null | grep -q "^BAT" && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user