Auto-select GPU passthrough when only one option
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled
Some checks failed
Bump build.func Revision / bump-revision (push) Has been cancelled
Improves the select_hw_passthrough function to automatically select the available GPU passthrough option if only one is detected, instead of prompting the user. This streamlines the user experience when only a single GPU type is present.
This commit is contained in:
parent
3d09942544
commit
020f55e26c
@ -23,20 +23,24 @@ select_hw_passthrough() {
|
|||||||
[[ -d /dev/dri ]] && choices+=("VAAPI" "Intel/AMD GPU via VAAPI" OFF)
|
[[ -d /dev/dri ]] && choices+=("VAAPI" "Intel/AMD GPU via VAAPI" OFF)
|
||||||
compgen -G "/dev/nvidia*" >/dev/null && choices+=("NVIDIA" "NVIDIA GPU passthrough" OFF)
|
compgen -G "/dev/nvidia*" >/dev/null && choices+=("NVIDIA" "NVIDIA GPU passthrough" OFF)
|
||||||
|
|
||||||
|
# no GPUs found
|
||||||
[[ ${#choices[@]} -eq 0 ]] && {
|
[[ ${#choices[@]} -eq 0 ]] && {
|
||||||
msg_info "No GPU devices detected"
|
msg_info "No GPU devices detected"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
local HEIGHT WIDTH
|
|
||||||
HEIGHT=12
|
|
||||||
WIDTH=70
|
|
||||||
local SELECTED
|
local SELECTED
|
||||||
SELECTED=$(whiptail --title "GPU Passthrough" \
|
if [[ ${#choices[@]} -eq 2 ]]; then
|
||||||
--checklist "Select GPU passthrough for CT $CTID:" $HEIGHT $WIDTH 2 \
|
# both available → show whiptail
|
||||||
"${choices[@]}" 3>&1 1>&2 2>&3) || return
|
SELECTED=$(whiptail --title "GPU Passthrough" \
|
||||||
|
--checklist "Select GPU passthrough for CT $CTID:" 12 70 2 \
|
||||||
|
"${choices[@]}" 3>&1 1>&2 2>&3) || return
|
||||||
|
else
|
||||||
|
# only one option → auto-select
|
||||||
|
SELECTED="\"${choices[0]}\""
|
||||||
|
msg_info "Auto-selecting GPU passthrough: ${choices[0]}"
|
||||||
|
fi
|
||||||
|
|
||||||
# export flags for install.sh
|
|
||||||
for sel in $SELECTED; do
|
for sel in $SELECTED; do
|
||||||
case "$sel" in
|
case "$sel" in
|
||||||
"\"VAAPI\"")
|
"\"VAAPI\"")
|
||||||
@ -51,7 +55,6 @@ select_hw_passthrough() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Apps that benefit from GPU passthrough (VAAPI + NVIDIA)
|
|
||||||
# Apps that benefit from GPU passthrough (VAAPI + NVIDIA)
|
# Apps that benefit from GPU passthrough (VAAPI + NVIDIA)
|
||||||
_GPU_APPS=(
|
_GPU_APPS=(
|
||||||
immich
|
immich
|
||||||
|
Loading…
x
Reference in New Issue
Block a user