testsAndMisc/linux_configuration/scripts/single_use/fresh-install/detect_gpu.sh
Krzysztof kuhy Rudnicki db6276b3ff refactor(linux_configuration): move remaining dirs + scripts/ to meta/
- Move fresh-install/ → scripts/single_use/fresh-install/
- Move hosts/ → scripts/periodic_background/hosts/
- Move i3-configuration/ → scripts/periodic_background/i3-configuration/
- Delete linux_configuration/LaTeX/, nix-poc/, report/ (dead dirs)
- Move repo-root scripts/ → meta/scripts/
- Update root .pre-commit-config.yaml: scripts/ → meta/scripts/ (9 entries)
- Update run.sh ARTIFACT_INIT_SCRIPT to meta/scripts/
- Update fresh-install/main.sh: hosts/install.sh + i3-configuration/install.sh paths
- Update check_python_location.sh: add meta/scripts/ to exception list
- Fix midnight flakiness in test_recent_workout_returns_true: use timezone-aware
  local noon instead of now-1h to avoid SQL date() boundary issues
2026-05-15 00:53:01 +02:00

53 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Lightweight GPU detection script.
# Detects GPU vendor and invokes the corresponding vendor install/management script.
# Exports: GPU_VENDOR
# shellcheck source=./install_nvidia_driver.sh
# shellcheck source=./install_amd_driver.sh
# shellcheck source=./install_intel_driver.sh
set -e
GPU_VENDOR="unknown"
PCI_GPU_INFO=$(lspci -nn | grep -Ei 'vga|3d|display' || true)
if echo "$PCI_GPU_INFO" | grep -qi nvidia; then
GPU_VENDOR="nvidia"
elif echo "$PCI_GPU_INFO" | grep -Eqi '\b(amd|advanced micro devices|ati)\b'; then
GPU_VENDOR="amd"
elif echo "$PCI_GPU_INFO" | grep -qi intel; then
GPU_VENDOR="intel"
fi
export GPU_VENDOR
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
case "$GPU_VENDOR" in
nvidia)
if [ -x "$SCRIPT_DIR/install_nvidia_driver.sh" ]; then
# shellcheck source=./install_nvidia_driver.sh disable=SC1091
. "$SCRIPT_DIR/install_nvidia_driver.sh"
else
echo "NVIDIA installer script missing: $SCRIPT_DIR/install_nvidia_driver.sh"
fi
;;
amd)
if [ -x "$SCRIPT_DIR/install_amd_driver.sh" ]; then
# shellcheck source=./install_amd_driver.sh disable=SC1091
. "$SCRIPT_DIR/install_amd_driver.sh"
else
echo "AMD installer script missing: $SCRIPT_DIR/install_amd_driver.sh (placeholder)"
fi
;;
intel)
if [ -x "$SCRIPT_DIR/install_intel_driver.sh" ]; then
# shellcheck source=./install_intel_driver.sh disable=SC1091
. "$SCRIPT_DIR/install_intel_driver.sh"
else
echo "Intel installer script missing: $SCRIPT_DIR/install_intel_driver.sh"
fi
;;
*)
echo "Unknown / no discrete GPU detected."
;;
esac