Update add_gpu_vm.sh

This commit is contained in:
MacRimi
2026-04-06 23:10:02 +02:00
parent b4aadfee3e
commit f2229c2393

View File

@@ -438,12 +438,12 @@ ensure_selected_gpu_not_already_in_target_vm() {
local choice
local -a clear_opt=()
[[ "$WIZARD_CALL" != "true" ]] && clear_opt+=(--clear)
choice=$(dialog --stdout "${clear_opt[@]}" --backtitle "ProxMenux" --colors \
choice=$(dialog "${clear_opt[@]}" --backtitle "ProxMenux" --colors \
--title "$(translate 'GPU Already Assigned to This VM')" \
--menu "\n$(translate 'The selected GPU is already present in this VM. Select another GPU to continue:')" \
18 82 10 \
"${menu_items[@]}" \
2>/dev/tty) || exit 0
2>&1 >/dev/tty) || exit 0
SELECTED_GPU="${ALL_GPU_TYPES[$choice]}"
SELECTED_GPU_PCI="${ALL_GPU_PCIS[$choice]}"
@@ -634,12 +634,12 @@ select_gpu() {
local choice
local -a clear_opt=()
[[ "$WIZARD_CALL" != "true" ]] && clear_opt+=(--clear)
choice=$(dialog --stdout "${clear_opt[@]}" --backtitle "ProxMenux" --colors \
choice=$(dialog "${clear_opt[@]}" --backtitle "ProxMenux" --colors \
--title "$(translate 'Select GPU for VM Passthrough')" \
--menu "\n$(translate 'Select the GPU to pass through to the VM:')" \
18 82 10 \
"${menu_items[@]}" \
2>/dev/tty) || exit 0
2>&1 >/dev/tty) || exit 0
SELECTED_GPU="${ALL_GPU_TYPES[$choice]}"
SELECTED_GPU_PCI="${ALL_GPU_PCIS[$choice]}"
@@ -1104,12 +1104,12 @@ select_vm() {
exit 0
fi
SELECTED_VMID=$(dialog --stdout --backtitle "ProxMenux" \
SELECTED_VMID=$(dialog --backtitle "ProxMenux" \
--title "$(translate 'Select Virtual Machine')" \
--menu "\n$(translate 'Select the VM to add the GPU to:')" \
20 72 12 \
"${menu_items[@]}" \
2>/dev/tty) || exit 0
2>&1 >/dev/tty) || exit 0
VM_NAME=$(qm config "$SELECTED_VMID" 2>/dev/null | grep "^name:" | awk '{print $2}')
}
@@ -1210,13 +1210,13 @@ check_switch_mode() {
msg+="\Z1\Zb$(translate 'Start on boot enabled (onboot=1)'): ${onboot_count}\Zn\n"
msg+="\n\Z1$(translate 'After this LXC → VM switch, reboot the host so the new binding state is applied cleanly.')\Zn"
action_choice=$(dialog --stdout --backtitle "ProxMenux" --colors \
action_choice=$(dialog --backtitle "ProxMenux" --colors \
--title "$(translate 'GPU Used in LXC Containers')" \
--default-item "2" \
--menu "$msg" 25 96 8 \
"1" "$(translate 'Keep GPU in LXC config (disable Start on boot)')" \
"2" "$(translate 'Remove GPU from LXC config (keep Start on boot)')" \
2>/dev/tty) || exit 0
2>&1 >/dev/tty) || exit 0
case "$action_choice" in
1) LXC_SWITCH_ACTION="keep_gpu_disable_onboot" ;;
@@ -1292,15 +1292,13 @@ check_switch_mode() {
msg+="$(translate 'Choose conflict policy for the source VM:')"
local vm_action_choice
local -a clear_opt=()
[[ "$WIZARD_CALL" != "true" ]] && clear_opt+=(--clear)
vm_action_choice=$(dialog --stdout "${clear_opt[@]}" --backtitle "ProxMenux" --colors \
vm_action_choice=$(dialog --clear --backtitle "ProxMenux" --colors \
--title "$(translate 'GPU Already Assigned to Another VM')" \
--default-item "1" \
--menu "$msg" 24 98 8 \
"1" "$(translate 'Keep GPU in source VM config (disable Start on boot if enabled)')" \
"2" "$(translate 'Remove GPU from source VM config (keep Start on boot)')" \
2>/dev/tty) || exit 0
2>&1 >/dev/tty) || exit 0
case "$vm_action_choice" in
1) SWITCH_VM_ACTION="keep_gpu_disable_onboot" ;;
@@ -1378,9 +1376,7 @@ confirm_summary() {
local run_title
run_title=$(_get_vm_run_title)
local -a clear_opt=()
[[ "$WIZARD_CALL" != "true" ]] && clear_opt+=(--clear)
dialog "${clear_opt[@]}" --backtitle "ProxMenux" --colors \
dialog --clear --backtitle "ProxMenux" --colors \
--title "${run_title}" \
--yesno "$msg" 28 78
[[ $? -ne 0 ]] && exit 0