audio stack & GPU driver unification

- Unified PipeWire installation into a single checklist option ("PipeWire Audio Stack"). Removed confusing dual options (Standard/Backports) to streamline Debian 13 workflows. Added Bluetooth Hi-Res codec support (LDAC, aptX, AAC) with automatic detection of `libfdk-aac` variants across all Debian versions.
- Refactored `_install_nvidia_standard()` in `modules/gpu/nvidia.sh` to respect the `NVIDIA_DRIVER_MODE` signal from the dispatcher, eliminating external dependency on `nvidia-detect`. Added logic to select between Open Kernel Modules (Turing/Ada/Ampere) and Classic DKMS (Maxwell/Pascal/Volta). Enhanced confirmation dialogs to display both driver and kernel module versions.
- Updated `_install_mesa_32bit()` in `modules/gaming/_helpers.sh` with the same version resolution and upgrade logic as Audio, ensuring consistent UX for Backports selection on Debian 13.
- Expanded `NVIDIA_FAMILY_MAP` in `modules/gpu/_helpers.sh` to include missing silicon prefixes (Hopper, Blackwell variants) while maintaining "legacy" abstraction for driver policy separation.
This commit is contained in:
stornic56
2026-07-30 20:33:21 -05:00
committed by GitHub
parent 8a45d75e95
commit b423ccfc0b
5 changed files with 256 additions and 261 deletions
+82 -66
View File
@@ -7,17 +7,12 @@ _cat_audio() {
local -a items=() local -a items=()
local pw_state; pw_state=$(_state "pipewire") local pw_label="PipeWire Audio Stack (Bluetooth Hi-Res)"
items+=(
"pipewire-standard" "PipeWire Audio Stack (Recommended)" "$pw_state"
)
if [ "$DEBIAN_VERSION" = "13" ]; then local pw_state; pw_state=$(_state "pipewire-audio")
local bpo_state; bpo_state=$(_state "pipewire")
items+=( items+=(
"pipewire-backports" "PipeWire from Backports (v1.4.9)" "off" "pipewire-audio" "$pw_label" "$pw_state"
) )
fi
local alsa_state; alsa_state=$(_state "alsa-utils") local alsa_state; alsa_state=$(_state "alsa-utils")
items+=( items+=(
@@ -48,27 +43,9 @@ _cat_audio() {
local cleaned; cleaned=$(echo "$choices" | tr -d '"') local cleaned; cleaned=$(echo "$choices" | tr -d '"')
local do_pipewire_standard=false
local do_pipewire_backports=false
for pkg in $cleaned; do for pkg in $cleaned; do
case $pkg in case $pkg in
pipewire-standard) do_pipewire_standard=true ;; pipewire-audio) _install_pipewire_standard ;;
pipewire-backports) do_pipewire_backports=true ;;
esac
done
for pkg in $cleaned; do
case $pkg in
pipewire-standard)
if $do_pipewire_backports; then
continue
fi
_install_pipewire_standard
;;
pipewire-backports)
_install_pipewire_backports
;;
alsa-utils) alsa-utils)
if ! is_installed "alsa-utils"; then if ! is_installed "alsa-utils"; then
_run_install "alsa-utils alsa-ucm-conf" _run_install "alsa-utils alsa-ucm-conf"
@@ -100,70 +77,109 @@ _cat_audio() {
esac esac
done done
if $do_pipewire_standard || $do_pipewire_backports; then echo -e "${GREEN}Audio & Sound setup complete.${NC}"
}
_install_pipewire_standard() {
local bt_pkgs="libldacbt-abr2 libldacbt-enc2 libopenaptx0 libspa-0.2-bluetooth"
if apt-cache show libfdk-aac2t64 &>/dev/null; then
bt_pkgs+=" libfdk-aac2t64"
elif apt-cache show libfdk-aac2 &>/dev/null; then
bt_pkgs+=" libfdk-aac2"
fi
# ── Resolve versions (needed for both installed and not-installed branches) ──
local stable_ver=""
stable_ver=$(apt-cache policy pipewire-audio 2>/dev/null | awk 'NR==3 {print $2; exit}') || true
local bpo_ver=""
if [ "$DEBIAN_VERSION" = "13" ] && [ "$(is_backports_enabled)" = "true" ]; then
bpo_ver=$(apt-cache madison pipewire-audio 2>/dev/null | \
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1) || true
fi
local pkg_check="pipewire-audio"
[ "$DEBIAN_VERSION" = "11" ] && pkg_check="pipewire"
# ── Already installed branch ──
if is_installed "$pkg_check"; then
if [ -n "$bpo_ver" ]; then
local current_ver
current_ver=$(dpkg -l "$pkg_check" 2>/dev/null | awk '/^ii/{print $3}') || true
if _confirm "PipeWire" \
"PipeWire ${current_ver:+v${current_ver} }already installed.\n\nUpgrade to backports version v${bpo_ver}?"; then
echo "Upgrading PipeWire Audio Stack..."
echo "-> Target version: v${bpo_ver} (from ${DEBIAN_CODENAME}-backports)"
echo "-> Including Bluetooth Hi-Res codecs (LDAC, aptX, AAC)"
_run_cmd "PipeWire" \
"sudo apt install -y --reinstall -t ${DEBIAN_CODENAME}-backports pipewire-audio $bt_pkgs" \
"Upgrading PipeWire from backports..."
if [ "$DEBIAN_VERSION" != "11" ]; then if [ "$DEBIAN_VERSION" != "11" ]; then
echo "Restarting PipeWire services..." echo "Restarting PipeWire services..."
systemctl --user restart wireplumber pipewire pipewire-pulse 2>/dev/null || true systemctl --user restart wireplumber pipewire pipewire-pulse 2>/dev/null || true
echo -e "${GREEN}PipeWire services restarted.${NC}" echo -e "${GREEN}PipeWire services restarted.${NC}"
fi fi
return
fi
fi
echo "$pkg_check already installed."
return
fi fi
echo -e "${GREEN}Audio & Sound setup complete.${NC}" # ── Confirm dialog ──
} local apt_target="" pw_ver="" pw_src=""
if [ -n "$bpo_ver" ]; then
local msg="Backports repository is enabled.\n\n"
msg+="Available versions:\n"
msg+=" - Stable: v${stable_ver:-unknown}\n"
msg+=" - Backports: v${bpo_ver}\n\n"
msg+="Install from Backports (Recommended for newer hardware)\nor from Stable (more conservative)?"
if _confirm_custom "PipeWire Install" "$msg" "Backports" "Stable" 14 70; then
apt_target="-t ${DEBIAN_CODENAME}-backports"
pw_ver="$bpo_ver"
pw_src="from ${DEBIAN_CODENAME}-backports"
else
pw_ver="$stable_ver"
fi
else
local msg="PipeWire Audio Stack (v${stable_ver:-unknown})\n"
msg+="will be installed along with Bluetooth Hi-Res\n"
msg+="codecs (LDAC, aptX, AAC).\n\n"
msg+="Continue with installation?"
if ! _confirm "PipeWire Install" "$msg" 12 65; then
echo "PipeWire installation cancelled."
return
fi
pw_ver="$stable_ver"
fi
echo "Installing PipeWire Audio Stack..."
echo "-> Detected version: ${pw_ver:-unknown} ${pw_src:+($pw_src)}"
echo "-> Including Bluetooth Hi-Res codecs (LDAC, aptX, AAC)"
_install_pipewire_standard() {
case "$DEBIAN_VERSION" in case "$DEBIAN_VERSION" in
11) 11)
if ! is_installed "pipewire"; then
_run_cmd "PipeWire" \ _run_cmd "PipeWire" \
"sudo apt install -y pipewire libspa-0.2-bluetooth pipewire-alsa libspa-0.2-jack" \ "sudo apt install -y pipewire libspa-0.2-bluetooth pipewire-alsa libspa-0.2-jack $bt_pkgs" \
"Installing PipeWire (Bullseye basic mode)..." "Installing PipeWire (Bullseye basic mode)..."
echo -e "${GREEN}PipeWire installed (Bullseye basic mode).${NC}" echo -e "${GREEN}PipeWire installed (Bullseye basic mode).${NC}"
else
echo "PipeWire already installed."
fi
;; ;;
12) 12)
if ! is_installed "pipewire-audio"; then
_run_cmd "PipeWire" \ _run_cmd "PipeWire" \
"sudo apt install -y pipewire-audio" \ "sudo apt install -y pipewire-audio $bt_pkgs" \
"Installing pipewire-audio meta-package (Bookworm)..." "Installing pipewire-audio meta-package (Bookworm)..."
echo -e "${GREEN}PipeWire audio stack installed.${NC}" echo -e "${GREEN}PipeWire audio stack installed.${NC}"
else
echo "pipewire-audio already installed."
fi
;; ;;
13) 13)
if ! is_installed "pipewire-audio"; then
_run_cmd "PipeWire" \ _run_cmd "PipeWire" \
"sudo apt install -y pipewire-audio" \ "sudo apt install -y $apt_target pipewire-audio $bt_pkgs" \
"Installing pipewire-audio meta-package (Trixie)..." "Installing pipewire-audio meta-package (Trixie)..."
echo -e "${GREEN}PipeWire audio stack installed.${NC}" echo -e "${GREEN}PipeWire audio stack installed.${NC}"
else
echo "pipewire-audio already installed."
fi
;; ;;
esac esac
}
_install_pipewire_backports() { if [ "$DEBIAN_VERSION" != "11" ]; then
if [ "$DEBIAN_VERSION" != "13" ]; then echo "Restarting PipeWire services..."
echo -e "${YELLOW}Backports install is only available on Debian 13 (Trixie). Skipping.${NC}" systemctl --user restart wireplumber pipewire pipewire-pulse 2>/dev/null || true
return echo -e "${GREEN}PipeWire services restarted.${NC}"
fi
if ! is_backports_enabled; then
_msg "Backports Required" \
"Trixie-backports is not enabled.\n\nEnable it first via:\n Main Menu → 3 → Configure Repositories" 12 65
echo -e "${YELLOW}Skipping PipeWire from backports.${NC}"
return
fi
if ! is_installed "pipewire-audio"; then
_run_cmd "PipeWire Backports" \
"sudo apt install -y -t ${DEBIAN_CODENAME}-backports pipewire-audio" \
"Installing PipeWire from trixie-backports (v1.4.9)..."
else
echo "pipewire-audio already installed."
fi fi
} }
+41 -1
View File
@@ -29,10 +29,50 @@ _install_mesa_32bit() {
return return
fi fi
local apt_target="" # ── Resolve versions for display ──
local rep_pkg="${base_pkgs[0]}"
local stable_ver=""
stable_ver=$(apt-cache policy "$rep_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}') || true
local bpo_ver=""
if [ "$DEBIAN_VERSION" = "13" ] && [ "$(is_backports_enabled)" = "true" ]; then if [ "$DEBIAN_VERSION" = "13" ] && [ "$(is_backports_enabled)" = "true" ]; then
bpo_ver=$(apt-cache madison "$rep_pkg" 2>/dev/null | \
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1) || true
fi
local check_pkg="libgl1-mesa-dri:i386"
# ── Already installed branch ──
if is_installed "$check_pkg"; then
if [ -n "$bpo_ver" ]; then
local current_ver
current_ver=$(dpkg -l "$check_pkg" 2>/dev/null | awk '/^ii/{print $3}') || true
if _confirm "Mesa 32-bit" \
"Mesa 32-bit libraries ${current_ver:+v${current_ver} }already installed.\n\nReinstall from backports v${bpo_ver}?"; then
echo "Reinstalling Mesa 32-bit from backports..."
_run_cmd "Mesa 32-bit" \
"sudo apt install -y --reinstall -t ${DEBIAN_CODENAME}-backports ${install_list[*]}" \
"Reinstalling Mesa 32-bit from backports..."
echo -e "${GREEN}Mesa 32-bit libraries reinstalled.${NC}"
return
fi
fi
echo "Mesa 32-bit libraries already installed."
return
fi
# ── Not installed branch ──
local apt_target=""
if [ -n "$bpo_ver" ]; then
local msg="Backports repository is enabled.\n\n"
msg+="Available versions for Mesa 32-bit:\n"
msg+=" - Stable: v${stable_ver:-unknown}\n"
msg+=" - Backports: v${bpo_ver}\n\n"
msg+="Install from Backports or Stable?"
if _confirm_custom "Mesa 32-bit" "$msg" "Backports" "Stable" 14 70; then
apt_target="-t ${DEBIAN_CODENAME}-backports" apt_target="-t ${DEBIAN_CODENAME}-backports"
fi fi
fi
_run_cmd "Mesa 32-bit" "sudo apt install -y $apt_target ${install_list[*]}" \ _run_cmd "Mesa 32-bit" "sudo apt install -y $apt_target ${install_list[*]}" \
"Installing Mesa drivers (${#install_list[@]} packages)..." "Installing Mesa drivers (${#install_list[@]} packages)..."
echo -e "${GREEN}Mesa 32-bit libraries installed.${NC}" echo -e "${GREEN}Mesa 32-bit libraries installed.${NC}"
+23 -7
View File
@@ -197,16 +197,22 @@ _install_nvidia_stack() {
fi fi
elif [ "$DEBIAN_VERSION" = "13" ]; then elif [ "$DEBIAN_VERSION" = "13" ]; then
if [ "$(is_nvidia_blackwell)" = "true" ]; then local nv_arch
_install_nvidia_cuda_repo nv_arch=$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")
elif [ "$(is_nvidia_kepler)" = "true" ] || [ "$(is_nvidia_fermi)" = "true" ]; then case "$nv_arch" in
legacy)
_msg "NVIDIA — Trixie" \ _msg "NVIDIA — Trixie" \
"Kepler and Fermi GPUs are not supported\nin Debian 13 (Trixie).\n\nThe nvidia-legacy drivers are not available\nin this version of Debian.\n\nNo NVIDIA driver will be installed." "Kepler and Fermi GPUs are not supported\nin Debian 13 (Trixie).\n\nThe nvidia-legacy drivers are not available\nin this version of Debian.\n\nNo NVIDIA driver will be installed."
NVIDIA_DRIVER_MODE="" NVIDIA_DRIVER_MODE=""
elif [ "$(is_backports_kernel)" = "true" ]; then ;;
if [ "$(is_nvidia_maxwell)" = "true" ] || [ "$(is_nvidia_pascal)" = "true" ]; then blackwell)
_install_nvidia_cuda_repo
;;
maxwell|pascal|volta)
if [ "$(is_backports_kernel)" = "true" ]; then
local gpu_gen="Maxwell" local gpu_gen="Maxwell"
[ "$(is_nvidia_pascal)" = "true" ] && gpu_gen="Pascal" [ "$nv_arch" = "pascal" ] && gpu_gen="Pascal"
[ "$nv_arch" = "volta" ] && gpu_gen="Volta"
_msg "NVIDIA — Trixie + Backports" \ _msg "NVIDIA — Trixie + Backports" \
"INCOMPATIBILITY DETECTED: Your NVIDIA ${gpu_gen} GPU\n\ "INCOMPATIBILITY DETECTED: Your NVIDIA ${gpu_gen} GPU\n\
is NOT supported by the modern v590 driver.\n\n\ is NOT supported by the modern v590 driver.\n\n\
@@ -217,11 +223,21 @@ Forcing the stable driver path." 14 70
_install_nvidia_standard _install_nvidia_standard
NVIDIA_DRIVER_MODE="stable" NVIDIA_DRIVER_MODE="stable"
else else
_install_nvidia_cuda_repo _install_nvidia_standard
fi fi
;;
turing|ampere|ada)
NVIDIA_DRIVER_MODE="open"
_install_nvidia_standard
;;
*)
if [ "$(is_backports_kernel)" = "true" ]; then
_install_nvidia_cuda_repo
else else
_install_nvidia_standard _install_nvidia_standard
fi fi
;;
esac
else else
_install_nvidia_standard _install_nvidia_standard
+43 -105
View File
@@ -1,116 +1,54 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Shared helpers for GPU submodules # Shared helpers for GPU submodules
is_nvidia_kepler() { declare -A NVIDIA_FAMILY_MAP=(
local dev_id # Fermi / Kepler (Legacy: el shim se encarga de separarlos)
dev_id=$(timeout 2 lspci -nn | grep -iE "VGA|3D" | grep -i nvidia | grep -oP '10de:\K[0-9a-fA-F]+' | head -n1) ["06"]="legacy" ["0D"]="legacy" ["0E"]="legacy"
[ -z "$dev_id" ] && { echo false; return; } ["0F"]="legacy" ["10"]="legacy" ["11"]="legacy" ["12"]="legacy"
# Maxwell
["13"]="maxwell" ["14"]="maxwell" ["16"]="maxwell" ["17"]="maxwell"
# Pascal + Volta (Misma política de driver clásico)
["15"]="pascal" ["1B"]="pascal" ["1C"]="pascal" ["1D"]="pascal"
# Turing
["1E"]="turing" ["1F"]="turing" ["21"]="turing"
# Ampere
["20"]="ampere" ["22"]="ampere" ["24"]="ampere" ["25"]="ampere"
# Hopper
["23"]="hopper"
# Ada Lovelace
["26"]="ada" ["27"]="ada" ["28"]="ada"
# Blackwell
["29"]="blackwell" ["2B"]="blackwell" ["2C"]="blackwell"
["2D"]="blackwell" ["2E"]="blackwell" ["31"]="blackwell"
)
local dev_int detect_nvidia_arch() {
dev_int=$((16#${dev_id,,})) local pci_id="$1"
local prefix="${pci_id:0:2}"
# Bloque 1: GK107 (escritorio + móvil) — 0x0FC0..0x0FFF echo "${NVIDIA_FAMILY_MAP[$prefix]:-unknown}"
if [ "$dev_int" -ge $((16#0FC0)) ] && [ "$dev_int" -le $((16#0FFF)) ]; then echo true; return; fi
# Bloque 2: GK110/GK110B/GK210 acotado puro — 0x1000..0x103F
if [ "$dev_int" -ge $((16#1000)) ] && [ "$dev_int" -le $((16#103F)) ]; then echo true; return; fi
# Bloque 3: GK104/GK106 (completo) — 0x1180..0x11FF
if [ "$dev_int" -ge $((16#1180)) ] && [ "$dev_int" -le $((16#11FF)) ]; then echo true; return; fi
# Bloque 4: GK208/GK208B (completo) — 0x1280..0x12BF
if [ "$dev_int" -ge $((16#1280)) ] && [ "$dev_int" -le $((16#12BF)) ]; then echo true; return; fi
echo false
} }
is_nvidia_fermi() { _is_nvidia_kepler_id() {
local dev_id local dev_id="$1"
dev_id=$(timeout 2 lspci -nn | grep -iE "VGA|3D" | grep -i nvidia | grep -oP '10de:\K[0-9a-fA-F]+' | head -n1) [ -z "$dev_id" ] && return 1
[ -z "$dev_id" ] && { echo false; return; } local dev_int=$((16#${dev_id,,}))
[ "$dev_int" -ge $((16#0FC0)) ] && [ "$dev_int" -le $((16#0FFF)) ] && return 0
local dev_int [ "$dev_int" -ge $((16#1000)) ] && [ "$dev_int" -le $((16#103F)) ] && return 0
dev_int=$((16#${dev_id,,})) [ "$dev_int" -ge $((16#1180)) ] && [ "$dev_int" -le $((16#11FF)) ] && return 0
[ "$dev_int" -ge $((16#1280)) ] && [ "$dev_int" -le $((16#12BF)) ] && return 0
# GF100 / GF110 — GTX 480, GTX 580, Quadro 6000, Tesla C2050 return 1
if [ "$dev_int" -ge $((16#06C0)) ] && [ "$dev_int" -le $((16#06DF)) ]; then echo true; return; fi
# GF104 / GF114 — GTS 450, GTX 460M, GT 555M
if [ "$dev_int" -ge $((16#0DC0)) ] && [ "$dev_int" -le $((16#0DCF)) ]; then echo true; return; fi
# GF104 / GF108 — GT 445M, GT 435M, GT 550M
if [ "$dev_int" -ge $((16#0DD0)) ] && [ "$dev_int" -le $((16#0DDF)) ]; then echo true; return; fi
# GF108 — GT 440, GT 430, GT 520, GT 610, GT 620M, NVS 5400M
if [ "$dev_int" -ge $((16#0DE0)) ] && [ "$dev_int" -le $((16#0DEF)) ]; then echo true; return; fi
# GF108 — GT 525M, GT 540M, GT 550M, Quadro 600, Quadro 500M
if [ "$dev_int" -ge $((16#0DF0)) ] && [ "$dev_int" -le $((16#0DFF)) ]; then echo true; return; fi
# GF104 / GF114 — GTX 460, GTX 470M, GTX 485M
if [ "$dev_int" -ge $((16#0E22)) ] && [ "$dev_int" -le $((16#0E31)) ]; then echo true; return; fi
# GF119 — GT 520M, GT 610M, NVS 4200M
if [ "$dev_int" -ge $((16#1050)) ] && [ "$dev_int" -le $((16#105F)) ]; then echo true; return; fi
# GF110 — GTX 580, GTX 570, GTX 560 Ti, GTX 590
if [ "$dev_int" -ge $((16#1080)) ] && [ "$dev_int" -le $((16#108F)) ]; then echo true; return; fi
# GF110 — Tesla M2090, Quadro 5010M, Quadro 7000
if [ "$dev_int" -ge $((16#1090)) ] && [ "$dev_int" -le $((16#109F)) ]; then echo true; return; fi
# GF116 / GF119 — GTX 560, GTX 460 v2, GTX 555, GT 645
if [ "$dev_int" -ge $((16#1200)) ] && [ "$dev_int" -le $((16#120F)) ]; then echo true; return; fi
# GF116 / GF108 — GTX 550 Ti, GTS 450 rev, GT 545, GT 640 (Fermi)
if [ "$dev_int" -ge $((16#1240)) ] && [ "$dev_int" -le $((16#124F)) ]; then echo true; return; fi
echo false
} }
is_nvidia_maxwell() { 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; }
local dev_id 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; }
dev_id=$(timeout 2 lspci -nn | grep -iE "VGA|3D" | grep -i nvidia | grep -oP '10de:\K[0-9a-fA-F]+' | head -n1) is_nvidia_legacy() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "legacy" ]] && echo true || echo false; }
[ -z "$dev_id" ] && { echo false; return; } is_nvidia_maxwell() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "maxwell" ]] && echo true || echo false; }
is_nvidia_pascal() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "pascal" ]] && echo true || echo false; }
local dev_int is_nvidia_volta() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "volta" ]] && echo true || echo false; }
dev_int=$((16#${dev_id,,})) is_nvidia_turing() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "turing" ]] && echo true || echo false; }
is_nvidia_ampere() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "ampere" ]] && echo true || echo false; }
# GM108/GM107/GM204 — gama media/baja + Quadros M (incluye 980M/970M) is_nvidia_ada() { [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "ada" ]] && echo true || echo false; }
if [ "$dev_int" -ge $((16#1340)) ] && [ "$dev_int" -le $((16#13FF)) ]; then echo true; return; fi is_nvidia_blackwell(){ [ -n "$NVIDIA_GPU_DEVICE_ID" ] && [[ "$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")" == "blackwell" ]] && echo true || echo false; }
# GM206 — GTX 960, GTX 950, Quadro M2000
if [ "$dev_int" -ge $((16#1400)) ] && [ "$dev_int" -le $((16#14FF)) ]; then echo true; return; fi
# GM200 — TITAN X, GTX 980 Ti
if [ "$dev_int" -ge $((16#17C0)) ] && [ "$dev_int" -le $((16#17CF)) ]; then echo true; return; fi
# GM200 profesional — Quadro M6000, Tesla M40
if [ "$dev_int" -ge $((16#17F0)) ] && [ "$dev_int" -le $((16#17FF)) ]; then echo true; return; fi
echo false
}
is_nvidia_pascal() {
local dev_id
dev_id=$(timeout 2 lspci -nn | grep -iE "VGA|3D" | grep -i nvidia | grep -oP '10de:\K[0-9a-fA-F]+' | head -n1)
[ -z "$dev_id" ] && { echo false; return; }
local dev_int
dev_int=$((16#${dev_id,,}))
# GP100 — Tesla P100, Quadro GP100
if [ "$dev_int" -ge $((16#15F0)) ] && [ "$dev_int" -le $((16#15FF)) ]; then echo true; return; fi
# GP102 — TITAN Xp, GTX 1080 Ti, Tesla P40, Quadro P6000
if [ "$dev_int" -ge $((16#1B00)) ] && [ "$dev_int" -le $((16#1B3F)) ]; then echo true; return; fi
# GP104 — GTX 1080, GTX 1070, Quadro P5000/P4000/P5200/P4200
if [ "$dev_int" -ge $((16#1B80)) ] && [ "$dev_int" -le $((16#1BBF)) ]; then echo true; return; fi
# GP106 + GP107 — GTX 1060, GTX 1050 Ti, GTX 1050, Quadro P2000/P1000/P620/P600
if [ "$dev_int" -ge $((16#1C00)) ] && [ "$dev_int" -le $((16#1CFF)) ]; then echo true; return; fi
# GP108 — GT 1030, GT 1010, MX150/250/350/330, Quadro P520
if [ "$dev_int" -ge $((16#1D00)) ] && [ "$dev_int" -le $((16#1D7F)) ]; then echo true; return; fi
echo false
}
is_nvidia_blackwell() {
local dev_id
dev_id=$(timeout 2 lspci -nn | grep -iE "VGA|3D" | grep -i nvidia | grep -oP '10de:\K[0-9a-fA-F]+' | head -n1)
[ -z "$dev_id" ] && { echo false; return; }
local dev_int
dev_int=$((16#${dev_id,,}))
# Blackwell (GB20x) rango bajo: 0x2900 0x29BF
if [ "$dev_int" -ge $((16#2900)) ] && [ "$dev_int" -le $((16#29BF)) ]; then echo true; return; fi
# Blackwell (GB20x) rango alto: 0x2B80 0x31DF
if [ "$dev_int" -ge $((16#2B80)) ] && [ "$dev_int" -le $((16#31DF)) ]; then echo true; return; fi
echo false
}
is_amd_legacy_gcn() { is_amd_legacy_gcn() {
local dev_id local dev_id
+38 -53
View File
@@ -11,7 +11,8 @@ install_nvidia_driver() {
NVIDIA_DRIVER_MODE="" NVIDIA_DRIVER_MODE=""
local is_bpo_kernel; is_bpo_kernel=$(is_backports_kernel) local is_bpo_kernel; is_bpo_kernel=$(is_backports_kernel)
local is_kepler; is_kepler=$(is_nvidia_kepler) local nv_arch; nv_arch=$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")
local is_kepler="false"; [[ "$nv_arch" == "legacy" ]] && _is_nvidia_kepler_id "$NVIDIA_GPU_DEVICE_ID" && is_kepler="true"
local is_maxwell; is_maxwell=$(is_nvidia_maxwell) local is_maxwell; is_maxwell=$(is_nvidia_maxwell)
local is_pascal; is_pascal=$(is_nvidia_pascal) local is_pascal; is_pascal=$(is_nvidia_pascal)
local is_blackwell; is_blackwell=$(is_nvidia_blackwell) local is_blackwell; is_blackwell=$(is_nvidia_blackwell)
@@ -264,50 +265,32 @@ _install_nvidia_bookworm_kepler() {
# CASE C: Kernel stable (any distro) → Debian stable, optional backports # CASE C: Kernel stable (any distro) → Debian stable, optional backports
# ------------------------------------------------------------------- # -------------------------------------------------------------------
_install_nvidia_standard() { _install_nvidia_standard() {
local nv_pkg="" # --- 1. DETERMINAR PAQUETES BASADO EN LA SEÑAL ---
local nv_pkg="nvidia-driver"
local kernel_pkg=""
local use_bpo=false local use_bpo=false
local is_kepler
is_kepler=$(is_nvidia_kepler)
if [ "$is_kepler" = "true" ]; then case "${NVIDIA_DRIVER_MODE:-auto}" in
if [ "$DEBIAN_CODENAME" = "trixie" ]; then open)
_msg "NVIDIA Kepler" \ kernel_pkg="nvidia-open-kernel-dkms"
"Your GPU is NVIDIA Kepler architecture.\n\nThe nvidia-tesla-470 driver is not available\nin Debian 13 (Trixie).\n\nOptions:\n 1. Use Debian 12 (Bookworm) with nvidia-tesla-470\n 2. Use open-source Nouveau driver (limited)\n\nNo NVIDIA driver will be installed." 14 65 ;;
return 1 classic|stable|backports)
fi kernel_pkg="nvidia-kernel-dkms"
nv_pkg="nvidia-tesla-470-driver" ;;
echo -e "${YELLOW}Kepler GPU detected. Will use ${nv_pkg}.${NC}" auto)
else kernel_pkg="$(nvidia-detect 2>/dev/null | grep -oP 'nvidia-kernel-dkms' || echo "")"
local nd_ver [ -z "$kernel_pkg" ] && kernel_pkg="nvidia-kernel-dkms"
nd_ver=$(apt-cache policy nvidia-detect 2>/dev/null | awk 'NR==3 {print $2; exit}') || true ;;
if _confirm "NVIDIA Detect" "Install nvidia-detect to determine the correct driver?\n\n nvidia-detect ${nd_ver:-unknown}" 12 70; then esac
_run_cmd "NVIDIA" "sudo apt install -y nvidia-detect" "Installing nvidia-detect..."
else
echo "Skipping NVIDIA driver detection."
return 0
fi
local recommended
recommended=$(nvidia-detect 2>/dev/null | grep -oP 'nvidia[\w-]+(?= package)') || true
if [ -z "$recommended" ]; then
echo -e "${RED}nvidia-detect could not determine a suitable driver.${NC}"
return 1
fi
if [[ "$recommended" =~ legacy-390|legacy-340 ]]; then
echo -e "${RED}Your GPU requires $recommended, which is not available.${NC}"
return 1
fi
nv_pkg="$recommended"
fi
# Check for backports (optional, if repo enabled) # --- 2. DIÁLOGO DE BACKPORTS ---
local stable_nv_ver if [ "$(is_backports_enabled)" == "true" ] && [ "${NVIDIA_DRIVER_MODE:-auto}" != "stable" ]; then
local stable_nv_ver bpo_nv_ver msg
stable_nv_ver=$(apt-cache policy "$nv_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}') || true stable_nv_ver=$(apt-cache policy "$nv_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}') || true
if [ "$(is_backports_enabled)" == "true" ]; then bpo_nv_ver=$(apt-cache madison "$nv_pkg" 2>/dev/null | grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1) || true
local bpo_nv_ver
bpo_nv_ver=$(apt-cache madison "$nv_pkg" 2>/dev/null | \
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1) || true
if [ -n "$bpo_nv_ver" ]; then if [ -n "$bpo_nv_ver" ]; then
local msg="Source: Debian ${DEBIAN_CODENAME^} (Backports available)\n" msg="Source: Debian ${DEBIAN_CODENAME^} (Backports available)\n"
msg+="NVIDIA Driver: ${nv_pkg}\n\n" msg+="NVIDIA Driver: ${nv_pkg}\n\n"
msg+=" Backports: ${bpo_nv_ver}\n" msg+=" Backports: ${bpo_nv_ver}\n"
msg+=" Stable: ${stable_nv_ver:-unknown}\n\n" msg+=" Stable: ${stable_nv_ver:-unknown}\n\n"
@@ -318,12 +301,18 @@ _install_nvidia_standard() {
fi fi
fi fi
# --- 3. MENSAJE DE CONFIRMACIÓN ---
local src_label="Debian ${DEBIAN_CODENAME^} Stable" local src_label="Debian ${DEBIAN_CODENAME^} Stable"
$use_bpo && src_label="Debian ${DEBIAN_CODENAME^}-Backports" $use_bpo && src_label="Debian ${DEBIAN_CODENAME^}-Backports"
local msg="Source: ${src_label}\n" local stable_nv_ver kernel_ver msg
stable_nv_ver=$(apt-cache policy "$nv_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}') || true
kernel_ver=$(apt-cache policy "$kernel_pkg" 2>/dev/null | awk 'NR==3 {print $2; exit}') || true
msg="Source: ${src_label}\n"
msg+="NVIDIA Driver: ${nv_pkg} ${stable_nv_ver:-unknown}\n" msg+="NVIDIA Driver: ${nv_pkg} ${stable_nv_ver:-unknown}\n"
msg+="[+] firmware-misc-nonfree\n" msg+="Kernel Module: ${kernel_pkg} ${kernel_ver:-unknown}\n"
msg+="[+] firmware-misc-nonfree (o firmware-nvidia-gsp en Trixie)\n"
msg+="[+] nvidia-vaapi-driver\n" msg+="[+] nvidia-vaapi-driver\n"
msg+="[+] mesa-vdpau-drivers" msg+="[+] mesa-vdpau-drivers"
@@ -332,29 +321,25 @@ _install_nvidia_standard() {
return 0 return 0
fi fi
# --- 4. EJECUCIÓN ---
local extra_pkgs="firmware-misc-nonfree nvidia-vaapi-driver mesa-vdpau-drivers" local extra_pkgs="firmware-misc-nonfree nvidia-vaapi-driver mesa-vdpau-drivers"
local install_pkgs="$kernel_pkg $nv_pkg $extra_pkgs"
if $use_bpo; then if $use_bpo; then
_run_cmd "NVIDIA" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports $nv_pkg $extra_pkgs" \ _run_cmd "NVIDIA" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports $install_pkgs" \
"Installing NVIDIA driver from backports..." "Installing NVIDIA driver from backports..."
NVIDIA_DRIVER_MODE="backports" NVIDIA_DRIVER_MODE="backports"
else else
_run_cmd "NVIDIA" "sudo apt install -y $nv_pkg $extra_pkgs" \ _run_cmd "NVIDIA" "sudo apt install -y $install_pkgs" \
"Installing NVIDIA driver from stable..." "Installing NVIDIA driver from stable..."
NVIDIA_DRIVER_MODE="stable" NVIDIA_DRIVER_MODE="stable"
fi fi
# --- 5. VERIFICACIÓN DKMS ---
echo -e "${GREEN}NVIDIA driver installed. Reboot required.${NC}" echo -e "${GREEN}NVIDIA driver installed. Reboot required.${NC}"
echo ""
echo "──────────────────────────────────────────────" echo "──────────────────────────────────────────────"
echo "Verifying DKMS module compilation:" echo "Verifying DKMS module compilation:"
if command -v dkms &>/dev/null; then command -v dkms &>/dev/null && dkms status 2>/dev/null | grep nvidia || echo "(no nvidia DKMS module found)"
dkms status 2>/dev/null | grep nvidia || echo "(no nvidia DKMS module found)"
else
echo "(dkms not installed)"
fi
echo ""
echo "If the line ends with 'installed' → module is OK." echo "If the line ends with 'installed' → module is OK."
echo "Otherwise check: dmesg | grep nvidia"
echo "──────────────────────────────────────────────" echo "──────────────────────────────────────────────"
} }