mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-03 20:03:25 +01:00
feat: add NVIDIA driver install prompt for GPU-enabled containers (#11184)
This commit is contained in:
@@ -2631,6 +2631,7 @@ function setup_hwaccel() {
|
||||
# GPU Selection - Let user choose which GPU(s) to configure
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
local -a SELECTED_INDICES=()
|
||||
local install_nvidia_drivers="yes"
|
||||
|
||||
if [[ $gpu_count -eq 1 ]]; then
|
||||
# Single GPU - auto-select
|
||||
@@ -2692,6 +2693,30 @@ function setup_hwaccel() {
|
||||
fi
|
||||
fi
|
||||
|
||||
# Ask whether to install NVIDIA drivers in the container
|
||||
local nvidia_selected="no"
|
||||
for idx in "${SELECTED_INDICES[@]}"; do
|
||||
if [[ "${GPU_TYPES[$idx]}" == "NVIDIA" ]]; then
|
||||
nvidia_selected="yes"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$nvidia_selected" == "yes" ]]; then
|
||||
if [[ -n "${INSTALL_NVIDIA_DRIVERS:-}" ]]; then
|
||||
install_nvidia_drivers="${INSTALL_NVIDIA_DRIVERS}"
|
||||
else
|
||||
echo ""
|
||||
msg_custom "🎮" "${GN}" "NVIDIA GPU passthrough detected"
|
||||
local nvidia_reply=""
|
||||
read -r -t 60 -p "${TAB3}⚙️ Install NVIDIA driver libraries in the container? [Y/n] (auto-yes in 60s): " nvidia_reply || nvidia_reply=""
|
||||
case "${nvidia_reply,,}" in
|
||||
n | no) install_nvidia_drivers="no" ;;
|
||||
*) install_nvidia_drivers="yes" ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
# OS Detection
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
@@ -2752,7 +2777,11 @@ function setup_hwaccel() {
|
||||
# NVIDIA GPUs
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
NVIDIA)
|
||||
_setup_nvidia_gpu "$os_id" "$os_codename" "$os_version"
|
||||
if [[ "$install_nvidia_drivers" == "yes" ]]; then
|
||||
_setup_nvidia_gpu "$os_id" "$os_codename" "$os_version"
|
||||
else
|
||||
msg_warn "Skipping NVIDIA driver installation (user opted to install manually)"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user