mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-23 04:02:16 +00:00
Update add_gpu_vm.sh
This commit is contained in:
@@ -438,12 +438,12 @@ ensure_selected_gpu_not_already_in_target_vm() {
|
|||||||
local choice
|
local choice
|
||||||
local -a clear_opt=()
|
local -a clear_opt=()
|
||||||
[[ "$WIZARD_CALL" != "true" ]] && clear_opt+=(--clear)
|
[[ "$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')" \
|
--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:')" \
|
--menu "\n$(translate 'The selected GPU is already present in this VM. Select another GPU to continue:')" \
|
||||||
18 82 10 \
|
18 82 10 \
|
||||||
"${menu_items[@]}" \
|
"${menu_items[@]}" \
|
||||||
2>/dev/tty) || exit 0
|
2>&1 >/dev/tty) || exit 0
|
||||||
|
|
||||||
SELECTED_GPU="${ALL_GPU_TYPES[$choice]}"
|
SELECTED_GPU="${ALL_GPU_TYPES[$choice]}"
|
||||||
SELECTED_GPU_PCI="${ALL_GPU_PCIS[$choice]}"
|
SELECTED_GPU_PCI="${ALL_GPU_PCIS[$choice]}"
|
||||||
@@ -634,12 +634,12 @@ select_gpu() {
|
|||||||
local choice
|
local choice
|
||||||
local -a clear_opt=()
|
local -a clear_opt=()
|
||||||
[[ "$WIZARD_CALL" != "true" ]] && clear_opt+=(--clear)
|
[[ "$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')" \
|
--title "$(translate 'Select GPU for VM Passthrough')" \
|
||||||
--menu "\n$(translate 'Select the GPU to pass through to the VM:')" \
|
--menu "\n$(translate 'Select the GPU to pass through to the VM:')" \
|
||||||
18 82 10 \
|
18 82 10 \
|
||||||
"${menu_items[@]}" \
|
"${menu_items[@]}" \
|
||||||
2>/dev/tty) || exit 0
|
2>&1 >/dev/tty) || exit 0
|
||||||
|
|
||||||
SELECTED_GPU="${ALL_GPU_TYPES[$choice]}"
|
SELECTED_GPU="${ALL_GPU_TYPES[$choice]}"
|
||||||
SELECTED_GPU_PCI="${ALL_GPU_PCIS[$choice]}"
|
SELECTED_GPU_PCI="${ALL_GPU_PCIS[$choice]}"
|
||||||
@@ -1104,12 +1104,12 @@ select_vm() {
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SELECTED_VMID=$(dialog --stdout --backtitle "ProxMenux" \
|
SELECTED_VMID=$(dialog --backtitle "ProxMenux" \
|
||||||
--title "$(translate 'Select Virtual Machine')" \
|
--title "$(translate 'Select Virtual Machine')" \
|
||||||
--menu "\n$(translate 'Select the VM to add the GPU to:')" \
|
--menu "\n$(translate 'Select the VM to add the GPU to:')" \
|
||||||
20 72 12 \
|
20 72 12 \
|
||||||
"${menu_items[@]}" \
|
"${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}')
|
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+="\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"
|
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')" \
|
--title "$(translate 'GPU Used in LXC Containers')" \
|
||||||
--default-item "2" \
|
--default-item "2" \
|
||||||
--menu "$msg" 25 96 8 \
|
--menu "$msg" 25 96 8 \
|
||||||
"1" "$(translate 'Keep GPU in LXC config (disable Start on boot)')" \
|
"1" "$(translate 'Keep GPU in LXC config (disable Start on boot)')" \
|
||||||
"2" "$(translate 'Remove GPU from LXC config (keep 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
|
case "$action_choice" in
|
||||||
1) LXC_SWITCH_ACTION="keep_gpu_disable_onboot" ;;
|
1) LXC_SWITCH_ACTION="keep_gpu_disable_onboot" ;;
|
||||||
@@ -1292,15 +1292,13 @@ check_switch_mode() {
|
|||||||
msg+="$(translate 'Choose conflict policy for the source VM:')"
|
msg+="$(translate 'Choose conflict policy for the source VM:')"
|
||||||
|
|
||||||
local vm_action_choice
|
local vm_action_choice
|
||||||
local -a clear_opt=()
|
vm_action_choice=$(dialog --clear --backtitle "ProxMenux" --colors \
|
||||||
[[ "$WIZARD_CALL" != "true" ]] && clear_opt+=(--clear)
|
|
||||||
vm_action_choice=$(dialog --stdout "${clear_opt[@]}" --backtitle "ProxMenux" --colors \
|
|
||||||
--title "$(translate 'GPU Already Assigned to Another VM')" \
|
--title "$(translate 'GPU Already Assigned to Another VM')" \
|
||||||
--default-item "1" \
|
--default-item "1" \
|
||||||
--menu "$msg" 24 98 8 \
|
--menu "$msg" 24 98 8 \
|
||||||
"1" "$(translate 'Keep GPU in source VM config (disable Start on boot if enabled)')" \
|
"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" "$(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
|
case "$vm_action_choice" in
|
||||||
1) SWITCH_VM_ACTION="keep_gpu_disable_onboot" ;;
|
1) SWITCH_VM_ACTION="keep_gpu_disable_onboot" ;;
|
||||||
@@ -1378,9 +1376,7 @@ confirm_summary() {
|
|||||||
local run_title
|
local run_title
|
||||||
run_title=$(_get_vm_run_title)
|
run_title=$(_get_vm_run_title)
|
||||||
|
|
||||||
local -a clear_opt=()
|
dialog --clear --backtitle "ProxMenux" --colors \
|
||||||
[[ "$WIZARD_CALL" != "true" ]] && clear_opt+=(--clear)
|
|
||||||
dialog "${clear_opt[@]}" --backtitle "ProxMenux" --colors \
|
|
||||||
--title "${run_title}" \
|
--title "${run_title}" \
|
||||||
--yesno "$msg" 28 78
|
--yesno "$msg" 28 78
|
||||||
[[ $? -ne 0 ]] && exit 0
|
[[ $? -ne 0 ]] && exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user