mirror of
https://github.com/stornic56/debianito-post-install.git
synced 2026-10-31 21:18:08 +00:00
89233b0750
- `.github/workflows/ci.yml` added as a new workflow: job `lint-and-test` on `runs-on: ubuntu-latest` with `container: debian:trixie`, checking out via `actions/checkout@v4`, installing `bats` and `shellcheck`, running `shellcheck --severity=error debianito.sh modules/**/*.sh` (with `shopt -s globstar`) and `bats tests/`.
- `debianito.sh` CLI parser: `AUTO_YES=0`, `ALLOW_DESTRUCTIVE=0` declared after `MODULES_DIR` and before `_boot_mark`; `_usage()` prints `Usage: debianito.sh [OPTIONS]` with `--yes`, `--allow-destructive` and `--help`; the `while [ $# -gt 0 ]` / `case` loop consumes `--yes` and `--allow-destructive`, prints `Unknown option: $1 (run with --help for usage)` to stderr and `exit 2` for unknown flags, and `--help|-h` runs `_usage` then `exit 0`.
- `modules/utils.sh`: new global `_SELECTION_CONFIRMED=0` and `_confirm_install_list()` (utils.sh:756-785), which renders items capped at 15 with `... and N more`, computes `height` capped at 24, calls `_confirm "$title" "$list" "$height" 65`, arms `_SELECTION_CONFIRMED=${#items[@]}` on yes, and returns 1 for an empty list or on decline. `_install_pkg()` (utils.sh:789-804) decrements the countdown instead of prompting, and only prompts via `elif ! _confirm "Install: ${pkg}" "Install ${pkg}\nVersion: ${ver}?"; then return 0`.
- Bulk retrofit in `modules/extras/**/*.sh` (18 sites): `_confirm_install_list "Título" "${array[@]}" || return` placed right after the `whiptail` selection is parsed, the install loop left intact, and `_SELECTION_CONFIRMED=0` after the loop. Files: office/office.sh:101, system/software_centers.sh:29, system/system.sh:133, communication/communication.sh:68, design/design.sh:42, download/download.sh:48+55, terminals/terminals.sh:31, security/security.sh:30, players/players.sh:20, themes/fonts/fonts.sh:32, dev/dev.sh:44, programming/programming.sh:57, themes/desktop-themes/desktop-themes.sh:30, fetch/fetch.sh:41, themes/icons/icons.sh:47, themes/cursors/cursors.sh:28, internet/internet.sh:197, java.
- `modules/bullseye/extras.sh` (13 sites) plus `modules/bullseye/legacy.sh` (1 site, `install_gaming_bullseye`, guarded with `if [ ${#_install_pkgs[@]} -gt 0 ]` so a i386-only selection does not blank the summary) plus `modules/desktop_display.sh` (1 site, XFCE Custom — a no-loop `_run_cmd` batch with the reset immediately after it). Special cases: download.sh and bullseye/download each have two checklists merged into one combined summary; legacy.sh gaming skips the reset when the list is empty; XFCE Custom resets before `_xfce_polkit_rules` so the counter cannot leak.
- `modules/desktops/desktop_gnome.sh` (new): `gnome_menu()` runs a `_radiolist` with "1" "GNOME (Full Desktop)", "2" "GNOME Core (Minimal Install)", "3" "Back", then `_install_gnome_full()` and `_install_gnome_core()`. Each arms `_confirm_install_list "GNOME Full Desktop" gnome gdm3 || return` (core: `gnome-core gdm3`), keeps an already-configured display manager via `_existing_display_manager` by setting `target_dm="$keep_dm"`, writes the preseed `echo "${target_dm} shared/default-x-display-manager select ${target_dm}" | sudo debconf-set-selections`, installs `sudo apt install -y gnome gdm3` / `gnome-core gdm3`, enables `gdm3` only when `target_dm = "gdm3"`, resets `_SELECTION_CONFIRMED=0` and calls `_offer_pipewire_after_desktop`.
- `modules/desktops/desktop_kde.sh` (new): `kde_menu()` runs a `_radiolist` with "1" "KDE Plasma (Full Desktop)", "2" "KDE Plasma Desktop (Minimal)", "3" "Back"; `_install_kde_full()` and `_install_kde_minimal()` arm `_confirm_install_list "KDE Plasma Full" kde-standard sddm || return` (minimal: `kde-plasma-desktop sddm`), preseed `sddm shared/default-x-display-manager select sddm`, install `sudo apt install -y kde-standard sddm` / `kde-plasma-desktop sddm`, enable `sddm` only when it is the target DM, reset the counter and offer PipeWire.
- `modules/desktop_display.sh` `desktop_environment_menu()`: `env_items+=("3" "GNOME")`, `env_items+=("4" "KDE Plasma")`, `env_items+=("5" "Back")`; the case adds `3)` loading `gnome` via `_load_module gnome || continue` and calling `gnome_menu`, and `4)` loading `kde` via `_load_module kde || continue` and calling `kde_menu`; the dead TODO comment was removed.
- PipeWire retrofit in `modules/desktop_display.sh` (6 sites): `_install_lxde_full`, `_install_lxde_core`, `_install_xfce_full`, `_install_xfce_minimal`, `_install_xfce_wayland` and `_install_xfce_custom` each call `_offer_pipewire_after_desktop` after their install block.
- `_offer_pipewire_after_desktop()` and `_existing_display_manager()` added at the end of `modules/desktop_display.sh`: `_offer_pipewire_after_desktop` checks `pipewire-audio` (`pipewire` when `DEBIAN_VERSION = 11`), returns 0 via `is_installed`, otherwise `_confirm "PipeWire Audio" "No PipeWire audio server is installed.\n\nInstall the PipeWire audio stack (recommended)?"` calls `_install_pipewire_standard` and returns 0. `_existing_display_manager` reads `${DM_FILE:-/etc/X11/default-display-manager}`, reads the basename as the DM, and otherwise scans `gdm3 lightdm sddm greetd gdm` with `systemctl is-enabled`, printing nothing when none is found.
- `_ensure_apt_updated` added before the GNOME/KDE `apt install` transactions (4 sites, deduplicated per session); `gnome gdm3` and `kde-standard sddm` are installed alongside even when another display manager is kept as the default.
- Extraction to `modules/desktops/`: `desktop_lxde.sh` (38 lines) and `desktop_xfce.sh` (119 lines) created with the `lxde_menu` / `_install_lxde_full` / `_install_lxde_core` and `xfce_menu` / `_install_xfce_full` / `_install_xfce_minimal` / `_install_xfce_wayland` / `_install_xfce_custom` / `_xfce_polkit_rules` blocks moved verbatim; both carry `# License GPL v3` in their headers.
- `modules/desktop_display.sh` reduced from 542 to 394 lines (−154): lines 55-208 removed, the dispatch (desktop_display.sh:39-46) replaced with `_load_module xfce || continue` / `lxde_menu`, and the file left with `manage_desktop_display`, `desktop_environment_menu`, `display_manager_menu`, `lightdm_config_menu`, `configure_greetd`, `configure_gdm3`, `configure_sddm`, the two shared helpers.
- `modules/utils.sh` `_load_module` map: `xfce)` → `${MODULES_DIR}/desktops/desktop_xfce.sh`, `lxde)` → `${MODULES_DIR}/desktops/desktop_lxde.sh`, `gnome)` → `${MODULES_DIR}/desktops/desktop_gnome.sh`, `kde)` → `${MODULES_DIR}/desktops/desktop_kde.sh`; deps for `xfce`, `lxde`, `gnome` and `kde` are `(desktop_display audio)` and `desktop_display` is `(repos audio)`.
- `modules/desktops/desktop_xfce.sh` `_xfce_polkit_rules()` writes `/etc/polkit-1/rules.d/85-suspend.rules` and `89-backlight.rules` via `sudo tee`, adds the `backlight` group with `groupadd --system` fallback, adds the real login user from `/etc/passwd` to `backlight` and restarts `polkit.service`.
- ES→EN user-facing strings: 14 strings across 4 files — `desktop_display.sh` `lxdе_menu` ("LXDE (Full Desktop)", "LXDE Core (Minimal Install)"), `gpu/nvidia.sh` Kepler legacy-driver notice ("Kepler GPU detected (GKxxx)… Install the legacy driver for Kepler?"), `bullseye/legacy.sh` ("Install NVIDIA driver?", "Skipping NVIDIA driver.", "Installing NVIDIA driver ${gpu_gen}...") and `bullseye/extras.sh` ("firmware-linux-nonfree provides drivers for… Install?").
- ES→EN internal comments: ~35 comments across 9 files — section headers in `_install_nvidia_standard`, `gpu/_helpers.sh` (lines 5, 113), `gpu/nvidia.sh` (lines 8-12, 19-22, 68-70, 167-172, 196, 239-253, 262-263, 275, 291, 336-338, 376), `gpu.sh` (lines 15-17), `bullseye/repos.sh` (line 2), `firmware.sh` (line 235, "--- Load verification ---"), `utils.sh` (lines 129, 132, 153 — timezone Paso 1/2/4) and `utils.sh:546,548`.
- set -e abort fix: `debianito.sh:149` now reads `_system_preferences_menu || true`, consistent with the other dispatch chains (14 of the 15 chains already had the guard); a declined pre-apply summary now leaves the TUI alive instead of terminating the script.
- `docs/desktops_display.md`: 4 hunks — intro now lists GNOME/GNOME Core/KDE Plasma/KDE Plasma Desktop/XFCE/XFCE Wayland/XFCE Custom/LXDE, a new "Modular layout" paragraph describing `modules/desktops/` and lazy loading, Block 1 rewritten into four environments, five new bullets (pre-apply summary, existing-DM preservation, PipeWire offer, stale-lists guard) and a Desktop Environment Packages table.
- `docs/quickstart.md` line 284: Desktop Environment entry expanded to pick from XFCE (full / minimal / Wayland `labwc` on Trixie / custom checklist), LXDE (full / core), GNOME (full / core) or KDE Plasma (full / minimal).
- `_existing_display_manager` now takes the config path via `local dm_file="${DM_FILE:-/etc/X11/default-display-manager}"` so the offline test suite never reads the real system file.
- `tests/test_helper.bash`: added `_mock_systemctl()` for `is-enabled` (units in `MOCK_SYSTEMCTL_ENABLED` report `enabled`, everything else `disabled`), `MOCK_SYSTEMCTL_ENABLED=""`, `WHIPTAIL_CALLS`/`MOCK_WHIPTAIL_OUTPUT`/`MOCK_WHIPTAIL_RC`, `MOCK_DPKG_INSTALLED` and the `systemctl` entry in the mock list and in `mock_reset()`.
- `tests/desktops.bats` created with 16 tests: `_existing_display_manager` (file read, file-preferred over an enabled unit, enabled-unit fallback, candidate order, missing file, nothing configured), `_offer_pipewire_after_desktop` (5 tests: skip-installed, accept-installs, decline-returns-0, Bullseye package name, wrong package name on 11), `_load_module` (4 tests for xfce/lxde/gnome/kde) and an unknown-module case; 17→33 tests total.
- `.github/workflows/ci.yml` shellcheck severity raised from `--severity=error` to `--severity=warning`.
- `debianito.sh`: `RED`, `GREEN`, `YELLOW`, `CYAN` and `NC` plus `AUTO_YES`, `ALLOW_DESTRUCTIVE` and `DEBIAN_CODENAME` are now `export`ed as cross-file globals.
- `modules/utils.sh`: `HAS_NVIDIA`, `DESKTOP_ENV`, `AUDIO_SERVER`, `DEBIAN_VERSION` and the other cross-file globals are `export`ed.
- `modules/extras/system/software_centers.sh` gained a `#!/usr/bin/env bash` shebang.
- `shellcheck` triage (v0.11.0, baseline `--severity=warning` 25 findings → 0): removed two dead-code lines (`headless` in `extras/dev/dev.sh`, orphan `dev_id` in `firmware.sh`); `SC2206` in `extras/dev/essential.sh` fixed by expanding `$comp_pkgs` to `"${comp_pkgs[@]}"`; `SC2010`/`SC2046` (3 sites) replaced `ls … | grep` with `compgen -G "…"`; `SC2155` (2 sites, `gpu.sh` and `rescue.sh`) split command substitutions into separate lines; `SC2166` in `repos.sh` replaced `-o` with `{ … || … }`; `SC2221`/`SC2222` (2 sites, `sysinfo.sh` and `utils.sh`) collapsed the `wl*|wlp*|wlo*|wlan*` alternation to `wl*`; `SC1090` in `extras.sh` gained a justification comment on the disable directive.
- Final verification: `bash -n` on all 15 modified `.sh` files and `set -euo pipefail` at `debianito.sh:3` both intact; `bats tests/` reports 33 ok / 0 failed; invariants `offers 11`, `confirm_install_list 39` and `_SELECTION_CONFIRMED=0 40` hold.
335 lines
13 KiB
Bash
335 lines
13 KiB
Bash
#!/usr/bin/env bash
|
|
# Graphics Stack — sources submodules, provides AMD/Intel and NVIDIA top-level functions
|
|
|
|
_GPU_DIR="${MODULES_DIR}/gpu"
|
|
source "${_GPU_DIR}/_helpers.sh"
|
|
source "${_GPU_DIR}/amd_intel.sh"
|
|
source "${_GPU_DIR}/nvidia.sh"
|
|
source "${_GPU_DIR}/nvidia_manage.sh"
|
|
|
|
# Consumed by gaming.sh to know which NVIDIA driver path was taken
|
|
NVIDIA_DRIVER_MODE=""
|
|
# Set by _show_nvidia_version_menu(): "470" | "535" | "550" | "590" | "595" | "auto"
|
|
NVIDIA_SELECTED_VERSION=""
|
|
|
|
# Informational post-install notice: NVIDIA Debian bug #1109409
|
|
# (GDM3 + NVIDIA + Wayland → black screen). Only informs, never
|
|
# changes GDM3 configuration nor aborts installation.
|
|
_warn_nvidia_gnome_wayland() {
|
|
command -v gdm3 &>/dev/null || return 0
|
|
gnome-shell --version 2>/dev/null | grep -qi "shell 4[0-9]" || return 0
|
|
case "$NVIDIA_DRIVER_MODE" in
|
|
stable | backports | cuda-repo | extrepo) ;;
|
|
*) return 0 ;;
|
|
esac
|
|
echo -e "${YELLOW}WARNING: Debian bug #1109409 may affect GDM3 + NVIDIA + Wayland.${NC}"
|
|
echo -e "${YELLOW}If you see a black screen after reboot, select 'GNOME on Xorg' at login.${NC}"
|
|
echo -e "${YELLOW}Or temporarily disable Wayland: sudo nano /etc/gdm3/daemon.conf${NC}"
|
|
}
|
|
|
|
_install_amd_intel_stack() {
|
|
# Hardware state is detected on demand; GPU_TYPE and
|
|
# LSPCI_OUTPUT must be populated before planning.
|
|
_ensure_state_detected
|
|
|
|
if [ "$GPU_TYPE" = "unknown" ] || [ -z "$GPU_TYPE" ]; then
|
|
local mesa_pkgs=(mesa-vulkan-drivers libgl1-mesa-dri libglx-mesa0 libegl-mesa0 mesa-va-drivers)
|
|
local ref_ver
|
|
ref_ver=$(apt-cache policy mesa-vulkan-drivers 2>/dev/null | awk 'NR==3 {print $2; exit}')
|
|
local ref_bpo_ver
|
|
ref_bpo_ver=$(apt-cache madison mesa-vulkan-drivers 2>/dev/null |
|
|
grep "${DEBIAN_CODENAME}-backports" | awk '{print $3}' | head -1 || true)
|
|
local comp_line="Components: Vulkan, OpenGL, GLX, EGL, VA-API (64-bit)"
|
|
|
|
if [ -n "$ref_bpo_ver" ] && [ "$(is_backports_enabled)" == "true" ]; then
|
|
local header="No dedicated GPU was detected (VM or headless).\n"
|
|
header+="Install Mesa stack for compute / display acceleration?\n\n"
|
|
header+="Source: Debian ${DEBIAN_CODENAME^}-Backports\n"
|
|
header+="Mesa ${ref_bpo_ver}\n"
|
|
header+="${comp_line}\n\n"
|
|
header+="Choose version:"
|
|
if _confirm_custom "No GPU Detected" "$header" "Backports" "Stable" 14 70; then
|
|
local _bpo_list=()
|
|
for _p in "${mesa_pkgs[@]}"; do
|
|
[ "$_p" != "mesa-va-drivers" ] && _bpo_list+=("$_p")
|
|
done
|
|
_run_cmd "Mesa" "sudo apt install -y -t ${DEBIAN_CODENAME}-backports ${_bpo_list[*]}" \
|
|
"Installing Mesa from backports..."
|
|
else
|
|
_run_cmd "Mesa" "sudo apt install -y ${mesa_pkgs[*]}" \
|
|
"Installing Mesa from stable..."
|
|
fi
|
|
else
|
|
if _confirm "No GPU Detected" \
|
|
"No dedicated GPU was detected (VM or headless).\n\nInstall Mesa stack?\n\nSource: Debian Stable\nMesa ${ref_ver}\n${comp_line}" 14 70; then
|
|
_run_cmd "Mesa" "sudo apt install -y ${mesa_pkgs[*]}" \
|
|
"Installing Mesa..."
|
|
else
|
|
echo "Skipping Mesa installation."
|
|
offer_generic_tools
|
|
return
|
|
fi
|
|
fi
|
|
offer_generic_tools
|
|
echo -e "${GREEN}Graphics stack setup complete.${NC}"
|
|
return
|
|
fi
|
|
|
|
local plan="The script has detected your graphics hardware.\n\n"
|
|
plan+="Detected GPUs:\n"
|
|
local gpu_count=0
|
|
while IFS= read -r gpu_line; do
|
|
gpu_count=$((gpu_count + 1))
|
|
local desc
|
|
desc=$(echo "$gpu_line" | sed -E 's/.*: //; s/ *\(rev.*//')
|
|
plan+=" GPU ${gpu_count}: ${desc}\n"
|
|
done < <(echo "$LSPCI_OUTPUT" | grep -E "VGA|3D" || true)
|
|
plan+="\nPlanned components:\n"
|
|
if $HAS_INTEL; then
|
|
local _gen
|
|
_gen=$(get_intel_generation)
|
|
local _va
|
|
[ "$_gen" = "gen7-" ] && _va="i965-va-driver-shaders" || _va="intel-media-va-driver-non-free"
|
|
plan+=" [+] Intel firmware + ${_va}\n"
|
|
fi
|
|
if $HAS_AMD; then
|
|
plan+=" [+] AMD firmware (firmware-amd-graphics)\n"
|
|
fi
|
|
plan+=" [+] Mesa (OpenGL/Vulkan/VA-API)\n"
|
|
|
|
_msg "Graphics Stack — Plan" "$plan" 16 70
|
|
|
|
if ! _confirm "Graphics Stack" "Install the planned components?"; then
|
|
echo "Skipping Graphics Stack."
|
|
return
|
|
fi
|
|
|
|
if $HAS_INTEL; then
|
|
install_intel_firmware
|
|
fi
|
|
if $HAS_AMD; then
|
|
install_amd_firmware
|
|
fi
|
|
|
|
if $HAS_AMD_LEGACY_GCN; then
|
|
local msg="An AMD GCN 1.0/GCN 1.1 GPU has been detected.\n\n"
|
|
msg+="These old GPUs use the legacy 'radeon' driver by default,\n"
|
|
msg+="but the modern 'amdgpu' driver offers better performance\n"
|
|
msg+="and Mesa support.\n\n"
|
|
msg+="Would you like to FORCE the amdgpu driver?\n"
|
|
msg+="(adds radeon.si_support=0 radeon.cik_support=0\n"
|
|
msg+=" amdgpu.si_support=1 amdgpu.cik_support=1 to GRUB)"
|
|
if _confirm "AMD Legacy GCN" "$msg" 16 72; then
|
|
_apply_amd_gcn_grub_fix
|
|
else
|
|
echo "Skipping amdgpu migration."
|
|
fi
|
|
fi
|
|
|
|
_install_mesa_backports
|
|
|
|
local mesa_ver
|
|
mesa_ver=$(dpkg -l libgl1-mesa-dri 2>/dev/null | awk '/^ii/ {print $3; exit}' | sed 's/-.*//')
|
|
[ -n "$mesa_ver" ] && GPU_VERSION="Mesa ${mesa_ver}"
|
|
|
|
if $HAS_INTEL; then
|
|
offer_intel_tools
|
|
fi
|
|
if $HAS_AMD; then
|
|
offer_amd_tools
|
|
fi
|
|
if ! $HAS_INTEL && ! $HAS_AMD; then
|
|
offer_generic_tools
|
|
fi
|
|
|
|
local summary="Mesa: ${GPU_VERSION:-not available}\n"
|
|
summary+="Firmware: installed for detected GPUs\n"
|
|
summary+="Tools: installed per vendor"
|
|
_msg "Graphics Stack — Complete" "$summary" 12 65
|
|
}
|
|
|
|
_apply_amd_gcn_grub_fix() {
|
|
local file="/etc/default/grub"
|
|
local backup
|
|
backup="${file}.backup.gcn.$(date +%Y%m%d_%H%M%S)"
|
|
local params="radeon.si_support=0 radeon.cik_support=0 amdgpu.si_support=1 amdgpu.cik_support=1"
|
|
|
|
if grep -q "amdgpu.si_support=1" "$file" 2>/dev/null; then
|
|
_msg "AMD GCN" "amdgpu parameters already present in GRUB.\nNo changes made." 8 50
|
|
return
|
|
fi
|
|
|
|
sudo cp "$file" "$backup"
|
|
|
|
if ! sudo grep -q "amdgpu.si_support=1" "$file"; then
|
|
sudo sed -i -E "/^GRUB_CMDLINE_LINUX_DEFAULT=/ s/\"([^\"]*)\"/\"${params} \1\"/" "$file"
|
|
fi
|
|
|
|
if _confirm "AMD GCN — GRUB" "Parameters added:\n\n ${params}\n\nRun update-grub now?" 12 65; then
|
|
if sudo update-grub >/dev/null 2>&1; then
|
|
_msg "AMD GCN — Complete" "amdgpu parameters added to GRUB.\n\nBackup: ${backup}\n\nReboot to apply."
|
|
else
|
|
echo -e "${RED}update-grub failed. Restoring backup...${NC}"
|
|
sudo cp "$backup" "$file"
|
|
_msg "Error" "update-grub failed.\nBackup restored."
|
|
fi
|
|
else
|
|
_msg "AMD GCN" "Parameters written to ${file}.\nRun 'sudo update-grub' manually."
|
|
fi
|
|
}
|
|
|
|
_install_nvidia_stack() {
|
|
# Hardware state is detected on demand; HAS_NVIDIA and
|
|
# LSPCI_OUTPUT must be populated before planning.
|
|
_ensure_state_detected
|
|
|
|
if ! $HAS_NVIDIA; then
|
|
_msg "NVIDIA Not Found" "No NVIDIA GPU was detected.\n\nPlease check your hardware and try again." 10 60
|
|
return
|
|
fi
|
|
|
|
local plan="The script has detected your NVIDIA GPU.\n\n"
|
|
plan+="Detected GPUs:\n"
|
|
local gpu_count=0
|
|
while IFS= read -r gpu_line; do
|
|
gpu_count=$((gpu_count + 1))
|
|
local desc
|
|
desc=$(echo "$gpu_line" | sed -E 's/.*: //; s/ *\(rev.*//')
|
|
plan+=" GPU ${gpu_count}: ${desc}\n"
|
|
done < <(echo "$LSPCI_OUTPUT" | grep -E "VGA|3D" || true)
|
|
plan+="\nPlanned:\n [+] NVIDIA proprietary driver"
|
|
|
|
_msg "NVIDIA Stack — Plan" "$plan" 14 65
|
|
_pause "Press Enter to continue..."
|
|
|
|
NVIDIA_DRIVER_MODE=""
|
|
|
|
if _nvidia_driver_installed; then
|
|
if ! _nvidia_manage_menu; then
|
|
return
|
|
fi
|
|
fi
|
|
|
|
if [ "$DEBIAN_VERSION" = "11" ]; then
|
|
if type install_nvidia_bullseye &>/dev/null; then
|
|
install_nvidia_bullseye
|
|
else
|
|
_msg "NVIDIA — Bullseye" "The Bullseye NVIDIA module is not available.\n\nNo NVIDIA driver was installed." 10 60
|
|
NVIDIA_DRIVER_MODE=""
|
|
fi
|
|
|
|
else
|
|
if ! _show_nvidia_version_menu; then
|
|
echo "Skipping NVIDIA driver installation."
|
|
return
|
|
fi
|
|
|
|
local nv_arch=""
|
|
case "$NVIDIA_SELECTED_VERSION" in
|
|
470)
|
|
# Legacy 470 (Kepler/Tesla) — forced, regardless of auto-detection
|
|
_install_nvidia_bookworm_kepler
|
|
;;
|
|
535)
|
|
if [ "$(is_nvidia_kepler)" = "true" ]; then
|
|
_install_nvidia_bookworm_kepler
|
|
elif [ "$(is_nvidia_fermi)" = "true" ]; then
|
|
_msg "NVIDIA Fermi — Bookworm" \
|
|
"Fermi GPUs (GF1xx) are not supported\nin Debian 12 (Bookworm).\nThe nvidia-legacy-390xx driver is\nnot available in this version.\n\nNo NVIDIA driver will be installed."
|
|
NVIDIA_DRIVER_MODE=""
|
|
else
|
|
_install_nvidia_standard
|
|
fi
|
|
;;
|
|
550)
|
|
nv_arch=$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")
|
|
case "$nv_arch" in
|
|
legacy)
|
|
_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."
|
|
NVIDIA_DRIVER_MODE=""
|
|
;;
|
|
blackwell)
|
|
_msg "NVIDIA — Blackwell (v550)" \
|
|
"Your Blackwell GPU is NOT supported by the official\nDebian v550 driver.\n\nPlease select v590 or v595 (NVIDIA CUDA Repo)\nin the driver menu." 14 65
|
|
NVIDIA_DRIVER_MODE=""
|
|
;;
|
|
maxwell | pascal | volta)
|
|
if [ "$(is_backports_kernel)" = "true" ]; then
|
|
local gpu_gen="Maxwell"
|
|
[ "$nv_arch" = "pascal" ] && gpu_gen="Pascal"
|
|
[ "$nv_arch" = "volta" ] && gpu_gen="Volta"
|
|
_msg "NVIDIA — Trixie + Backports" \
|
|
"INCOMPATIBILITY DETECTED: Your NVIDIA ${gpu_gen} GPU\n\
|
|
is NOT supported by the modern v590 driver.\n\n\
|
|
To run NVIDIA safely on Debian 13 (Trixie), you MUST use\n\
|
|
the official Debian v550 driver, which requires the\n\
|
|
standard STABLE Kernel.\n\n\
|
|
Forcing the stable driver path." 14 70
|
|
if ! _install_nvidia_standard; then
|
|
NVIDIA_DRIVER_MODE=""
|
|
return 1
|
|
fi
|
|
NVIDIA_DRIVER_MODE="stable"
|
|
else
|
|
_install_nvidia_standard
|
|
fi
|
|
;;
|
|
turing | ampere | ada)
|
|
_install_nvidia_standard
|
|
;;
|
|
*)
|
|
if [ "$(is_backports_kernel)" = "true" ]; then
|
|
_install_nvidia_cuda_repo
|
|
else
|
|
_install_nvidia_standard
|
|
fi
|
|
;;
|
|
esac
|
|
;;
|
|
590 | 595)
|
|
nv_arch=$(detect_nvidia_arch "$NVIDIA_GPU_DEVICE_ID")
|
|
if [ "$nv_arch" = "maxwell" ] || [ "$nv_arch" = "pascal" ] || [ "$nv_arch" = "legacy" ]; then
|
|
local gpu_gen="Kepler/Fermi"
|
|
[ "$nv_arch" = "maxwell" ] && gpu_gen="Maxwell"
|
|
[ "$nv_arch" = "pascal" ] && gpu_gen="Pascal"
|
|
_msg "NVIDIA — v${NVIDIA_SELECTED_VERSION}" \
|
|
"Your NVIDIA ${gpu_gen} GPU is NOT supported by\nNVIDIA driver v${NVIDIA_SELECTED_VERSION}.\n\n\
|
|
Only Turing, Ampere, Ada and Blackwell GPUs are supported.\n\n\
|
|
No NVIDIA driver will be installed." 14 65
|
|
NVIDIA_DRIVER_MODE=""
|
|
else
|
|
if ! _enable_cuda_repo; then
|
|
NVIDIA_DRIVER_MODE=""
|
|
_msg "CUDA Repo — Error" "Failed to enable the official NVIDIA CUDA repository.\n\nNo NVIDIA driver was installed." 10 60
|
|
return 1
|
|
fi
|
|
if _install_nvidia_cuda_repo "$NVIDIA_SELECTED_VERSION"; then
|
|
NVIDIA_DRIVER_MODE="cuda-repo"
|
|
else
|
|
NVIDIA_DRIVER_MODE=""
|
|
fi
|
|
fi
|
|
;;
|
|
*)
|
|
_install_nvidia_standard
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
if [ -n "$NVIDIA_DRIVER_MODE" ]; then
|
|
_configure_nvidia_wayland "$NVIDIA_SELECTED_VERSION"
|
|
if _is_hybrid_laptop; then
|
|
echo -e "${CYAN}[INFO] Hybrid GPU (Optimus) detected.${NC}"
|
|
echo -e "PRIME offload is auto-configured by X.Org 1.20.7+ when using X11."
|
|
echo -e "After reboot, verify with: ${YELLOW}xrandr --listproviders | grep NVIDIA-G0${NC}"
|
|
echo -e "If not found, ensure BIOS boots on iGPU and nvidia-drm is loaded."
|
|
fi
|
|
offer_generic_tools
|
|
_warn_nvidia_gnome_wayland
|
|
local summary="NVIDIA: ${NVIDIA_DRIVER_MODE}\n"
|
|
summary+="Tools: nvtop + vainfo"
|
|
_msg "NVIDIA Stack — Complete" "$summary" 10 55
|
|
fi
|
|
}
|