Update scripts

This commit is contained in:
MacRimi
2026-04-12 20:32:34 +02:00
parent 4fa4bbb08b
commit 4843fae0eb
47 changed files with 8313 additions and 3014 deletions

View File

@@ -80,21 +80,21 @@ function select_disk_type() {
while true; do
local choice
choice=$(whiptail --backtitle "ProxMenux" --title "STORAGE PLAN" --menu "$(_build_storage_plan_summary)" 18 78 5 \
"1" "$(translate "Add virtual disk")" \
"2" "$(translate "Add import disk")" \
"3" "$(translate "Add Controller or NVMe (PCI passthrough)")" \
"a" "$(translate "Add virtual disk")" \
"b" "$(translate "Add import disk")" \
"c" "$(translate "Add Controller or NVMe (PCI passthrough)")" \
"r" "$(translate "Reset current storage selection")" \
"d" "$(translate "[ Finish and continue ]")" \
"d" "$(translate "──── [ Finish and continue ] ────")" \
--ok-button "Select" --cancel-button "Cancel" 3>&1 1>&2 2>&3) || return 1
case "$choice" in
1)
a)
select_virtual_disk
;;
2)
b)
select_import_disk
;;
3)
c)
select_controller_nvme
;;
r)

View File

@@ -58,7 +58,7 @@ function select_linux_iso() {
--backtitle "ProxMenux" \
--title "Opciones de instalación de Linux" \
--menu "\nSeleccione el tipo de instalación de Linux:\n\n$header" \
18 72 10 \
20 70 10 \
1 "$(printf '%-35s│ %s' 'Instalar con metodo tradicional' 'Desde ISO oficial')" \
2 "$(printf '%-35s│ %s' 'Instalar con script Cloud-Init' 'Helper Scripts')" \
3 "$(printf '%-35s│ %s' 'Instalar con ISO personal' 'Almacenamiento local')" \
@@ -140,7 +140,7 @@ function select_linux_iso_official() {
CHOICE=$(dialog --backtitle "ProxMenux" \
--title "$(translate "Official Linux Distributions")" \
--menu "$(translate "Select the Linux distribution to install:")\n\n$HEADER_TEXT" 20 80 12 \
--menu "$(translate "Select the Linux distribution to install:")\n\n$HEADER_TEXT" 20 70 12 \
"${MENU_OPTIONS[@]}" \
3>&1 1>&2 2>&3)
@@ -269,7 +269,7 @@ local OTHER_OPTIONS=(
local choice
choice=$(dialog --backtitle "ProxMenux" \
--title "$(translate "Other Prebuilt Linux VMs")" \
--menu "\n$(translate "Select one of the ready-to-run Linux VMs:")" 18 70 10 \
--menu "\n$(translate "Select one of the ready-to-run Linux VMs:")" 20 70 10 \
"${OTHER_OPTIONS[@]}" 3>&1 1>&2 2>&3)
if [[ $? -ne 0 || "$choice" == "4" ]]; then

View File

@@ -51,7 +51,7 @@ function select_windows_iso() {
--backtitle "ProxMenux" \
--title "Opciones de instalación de Windows" \
--menu "\nSeleccione el tipo de instalación de Windows:\n\n$header" \
18 70 10 \
20 70 10 \
1 "$(printf '%-34s│ %s' 'Instalar con ISO UUP Dump' 'UUP Dump ISO creator')" \
2 "$(printf '%-34s│ %s' 'Instalar con ISO personal' 'Almacenamiento local')" \
3 "Volver al menú principal" \

View File

@@ -51,6 +51,11 @@ if [[ -f "$LOCAL_SCRIPTS_LOCAL/global/vm_storage_helpers.sh" ]]; then
elif [[ -f "$LOCAL_SCRIPTS_DEFAULT/global/vm_storage_helpers.sh" ]]; then
source "$LOCAL_SCRIPTS_DEFAULT/global/vm_storage_helpers.sh"
fi
if [[ -f "$LOCAL_SCRIPTS_LOCAL/vm/disk_selector.sh" ]]; then
source "$LOCAL_SCRIPTS_LOCAL/vm/disk_selector.sh"
elif [[ -f "$LOCAL_SCRIPTS_DEFAULT/vm/disk_selector.sh" ]]; then
source "$LOCAL_SCRIPTS_DEFAULT/vm/disk_selector.sh"
fi
if [[ -f "$LOCAL_SCRIPTS_LOCAL/global/pci_passthrough_helpers.sh" ]]; then
source "$LOCAL_SCRIPTS_LOCAL/global/pci_passthrough_helpers.sh"
elif [[ -f "$LOCAL_SCRIPTS_DEFAULT/global/pci_passthrough_helpers.sh" ]]; then
@@ -475,24 +480,24 @@ function select_disk_type() {
while true; do
local choice
choice=$(whiptail --backtitle "ProxMenuX" --title "STORAGE PLAN" --menu "$(_build_storage_plan_summary)" 18 78 5 \
"1" "$(translate "Add virtual disk")" \
"2" "$(translate "Add import disk")" \
"3" "$(translate "Add Controller or NVMe (PCI passthrough)")" \
"a" "$(translate "Add virtual disk")" \
"b" "$(translate "Add import disk")" \
"c" "$(translate "Add Controller or NVMe (PCI passthrough)")" \
"r" "$(translate "Reset current storage selection")" \
"d" "$(translate "[ Finish and continue ]")" \
"d" "$(translate "──── [ Finish and continue ] ────")" \
--ok-button "Select" --cancel-button "Cancel" 3>&1 1>&2 2>&3) || {
msg_warn "$(translate "Storage plan selection cancelled.")"
return 1
}
case "$choice" in
1)
a)
select_virtual_disk
;;
2)
b)
select_import_disk
;;
3)
c)
select_controller_nvme
;;
r)
@@ -575,50 +580,6 @@ function select_virtual_disk() {
VIRTUAL_DISKS+=("${STORAGE}:${DISK_SIZE}")
}
function select_import_disk() {
msg_info "$(translate "Detecting available disks...")"
_refresh_host_storage_cache
local FREE_DISKS=()
local DISK INFO MODEL SIZE LABEL DESCRIPTION
while read -r DISK; do
[[ "$DISK" =~ /dev/zd ]] && continue
_disk_is_host_system_used "$DISK" && continue
INFO=($(lsblk -dn -o MODEL,SIZE "$DISK"))
MODEL="${INFO[@]::${#INFO[@]}-1}"
SIZE="${INFO[-1]}"
LABEL=""
if _disk_used_in_guest_configs "$DISK"; then
LABEL+=" [⚠ $(translate "In use by VM/LXC config")]"
fi
DESCRIPTION=$(printf "%-30s %10s%s" "$MODEL" "$SIZE" "$LABEL")
if _array_contains "$DISK" "${IMPORT_DISKS[@]}"; then
FREE_DISKS+=("$DISK" "$DESCRIPTION" "ON")
else
FREE_DISKS+=("$DISK" "$DESCRIPTION" "OFF")
fi
done < <(lsblk -dn -e 7,11 -o PATH)
stop_spinner
if [[ ${#FREE_DISKS[@]} -eq 0 ]]; then
whiptail --title "Error" --msgbox "$(translate "No importable disks available. System disks and protected disks are hidden.")" 9 70
return 1
fi
local selected
selected=$(whiptail --title "Select Import Disks" --checklist \
"$(translate "Select the disks you want to import (use spacebar to toggle):")" 20 78 10 \
"${FREE_DISKS[@]}" 3>&1 1>&2 2>&3) || return 1
IMPORT_DISKS=()
local item
for item in $(echo "$selected" | tr -d '"'); do
IMPORT_DISKS+=("$item")
done
export IMPORT_DISKS
}
function select_controller_nvme() {
local VM_STORAGE_IOMMU_REBOOT_POLICY="defer"
@@ -747,7 +708,7 @@ function prompt_controller_conflict_policy() {
shift
local -a source_vms=("$@")
local msg vmid vm_name st ob
msg="$(translate "Selected controller/NVMe is already assigned to other VM(s):")\n\n"
msg="\n$(translate "Selected controller/NVMe is already assigned to other VM(s):")\n\n"
for vmid in "${source_vms[@]}"; do
vm_name=$(_vm_name_by_id "$vmid")
st="stopped"; _vm_status_is_running "$vmid" && st="running"
@@ -757,7 +718,7 @@ function prompt_controller_conflict_policy() {
msg+="\n$(translate "Choose action for this controller/NVMe:")"
local choice
choice=$(whiptail --title "$(translate "Controller/NVMe Conflict Policy")" --menu "$msg" 22 96 10 \
choice=$(whiptail --title "$(translate "Controller/NVMe Conflict Policy")" --menu "$msg" 20 80 10 \
"1" "$(translate "Keep in source VM(s) + disable onboot + add to target VM")" \
"2" "$(translate "Move to target VM (remove from source VM config)")" \
"3" "$(translate "Skip this device")" \
@@ -1486,18 +1447,26 @@ if [[ "$GPU_WIZARD_APPLIED" == "yes" ]]; then
echo -e "${TAB}$(translate "Then change the VM display to none (vga: none) when the system is stable.")"
fi
local HOST_REBOOT_REQUIRED="no"
local REBOOT_REASONS=""
if [[ "${VM_STORAGE_IOMMU_PENDING_REBOOT:-0}" == "1" ]]; then
HOST_REBOOT_REQUIRED="yes"
msg_warn "$(translate "IOMMU was enabled during this wizard. Reboot the host to apply it.")"
msg_ok "$(translate "IOMMU has been enabled — a system reboot is required")"
REBOOT_REASONS+="$(translate "IOMMU has been enabled on this system.")\n"
fi
if [[ "$GPU_WIZARD_REBOOT_REQUIRED" == "yes" ]]; then
HOST_REBOOT_REQUIRED="yes"
REBOOT_REASONS+="$(translate "GPU passthrough changes require a host reboot.")\n"
fi
if [[ "$HOST_REBOOT_REQUIRED" == "yes" ]]; then
if whiptail --title "$(translate "Reboot Recommended")" --yesno \
"$(translate "A host reboot is required to apply passthrough changes before starting the VM.")\n\n$(translate "Do you want to reboot now?")" 11 78; then
echo ""
if whiptail --title "$(translate "Reboot Required")" --yesno \
"\n${REBOOT_REASONS}\n$(translate "A host reboot is required before starting the VM. Reboot now?")" 13 78; then
msg_warn "$(translate "Rebooting the system...")"
reboot
else
echo ""
msg_info2 "$(translate "To use the VM without issues, the host must be restarted before starting it.")"
msg_info2 "$(translate "Do not start the VM until the system has been rebooted.")"
fi
fi
echo -e

View File

@@ -118,7 +118,7 @@ function prompt_controller_conflict_policy() {
shift
local -a source_vms=("$@")
local msg vmid vm_name st ob
msg="$(translate "Selected controller/NVMe is already assigned to other VM(s):")\n\n"
msg="\n$(translate "Selected controller/NVMe is already assigned to other VM(s):")\n\n"
for vmid in "${source_vms[@]}"; do
vm_name=$(_vm_name_by_id "$vmid")
st="stopped"; _vm_status_is_running "$vmid" && st="running"
@@ -128,7 +128,7 @@ function prompt_controller_conflict_policy() {
msg+="\n$(translate "Choose action for this controller/NVMe:")"
local choice
choice=$(whiptail --title "$(translate "Controller/NVMe Conflict Policy")" --menu "$msg" 22 96 10 \
choice=$(whiptail --title "$(translate "Controller/NVMe Conflict Policy")" --menu "$msg" 20 80 10 \
"1" "$(translate "Keep in source VM(s) + disable onboot + add to target VM")" \
"2" "$(translate "Move to target VM (remove from source VM config)")" \
"3" "$(translate "Skip this device")" \
@@ -554,6 +554,7 @@ fi
if qm set "$VMID" --hostpci${hostpci_idx} "${pci},pcie=1" >/dev/null 2>&1; then
msg_ok "$(translate "Controller/NVMe assigned") (hostpci${hostpci_idx}${pci})"
DISK_INFO+="<p>Controller/NVMe: ${pci}</p>"
BOOT_ORDER="${BOOT_ORDER:+$BOOT_ORDER;}hostpci${hostpci_idx}"
hostpci_idx=$((hostpci_idx + 1))
else
msg_error "$(translate "Failed to assign Controller/NVMe") (${pci})"
@@ -769,18 +770,26 @@ if [[ "${WIZARD_ADD_GPU:-no}" == "yes" ]]; then
echo -e
fi
local HOST_REBOOT_REQUIRED="no"
local REBOOT_REASONS=""
if [[ "${VM_STORAGE_IOMMU_PENDING_REBOOT:-0}" == "1" ]]; then
HOST_REBOOT_REQUIRED="yes"
msg_warn "$(translate "IOMMU was enabled during this wizard. Reboot the host to apply it.")"
msg_ok "$(translate "IOMMU has been enabled — a system reboot is required")"
REBOOT_REASONS+="$(translate "IOMMU has been enabled on this system.")\n"
fi
if [[ "$GPU_WIZARD_REBOOT_REQUIRED" == "yes" ]]; then
HOST_REBOOT_REQUIRED="yes"
REBOOT_REASONS+="$(translate "GPU passthrough changes require a host reboot.")\n"
fi
if [[ "$HOST_REBOOT_REQUIRED" == "yes" ]]; then
if whiptail --title "$(translate "Reboot Recommended")" --yesno \
"$(translate "A host reboot is required to apply passthrough changes before starting the VM.")\n\n$(translate "Do you want to reboot now?")" 11 78; then
echo ""
if whiptail --title "$(translate "Reboot Required")" --yesno \
"\n${REBOOT_REASONS}\n$(translate "A host reboot is required before starting the VM. Reboot now?")" 13 78; then
msg_warn "$(translate "Rebooting the system...")"
reboot
else
echo ""
msg_info2 "$(translate "To use the VM without issues, the host must be restarted before starting it.")"
msg_info2 "$(translate "Do not start the VM until the system has been rebooted.")"
fi
fi
msg_success "$(translate "Press Enter to return to the main menu...")"
@@ -807,10 +816,6 @@ elif [[ "$OS_TYPE" == "3" ]]; then
echo -e
fi
if [[ "${VM_STORAGE_IOMMU_PENDING_REBOOT:-0}" == "1" ]]; then
msg_warn "$(translate "IOMMU was enabled during this wizard. Reboot the host to apply it.")"
fi
msg_success "$(translate "Press Enter to return to the main menu...")"
read -r
bash "$LOCAL_SCRIPTS/menus/create_vm_menu.sh"

View File

@@ -44,6 +44,11 @@ if [[ -f "$LOCAL_SCRIPTS_LOCAL/global/vm_storage_helpers.sh" ]]; then
elif [[ -f "$LOCAL_SCRIPTS_DEFAULT/global/vm_storage_helpers.sh" ]]; then
source "$LOCAL_SCRIPTS_DEFAULT/global/vm_storage_helpers.sh"
fi
if [[ -f "$LOCAL_SCRIPTS_LOCAL/vm/disk_selector.sh" ]]; then
source "$LOCAL_SCRIPTS_LOCAL/vm/disk_selector.sh"
elif [[ -f "$LOCAL_SCRIPTS_DEFAULT/vm/disk_selector.sh" ]]; then
source "$LOCAL_SCRIPTS_DEFAULT/vm/disk_selector.sh"
fi
if [[ -f "$LOCAL_SCRIPTS_LOCAL/global/pci_passthrough_helpers.sh" ]]; then
source "$LOCAL_SCRIPTS_LOCAL/global/pci_passthrough_helpers.sh"
elif [[ -f "$LOCAL_SCRIPTS_DEFAULT/global/pci_passthrough_helpers.sh" ]]; then
@@ -490,24 +495,24 @@ function select_disk_type() {
while true; do
local choice
choice=$(whiptail --backtitle "ProxMenuX" --title "STORAGE PLAN" --menu "$(_build_storage_plan_summary)" 18 78 5 \
"1" "$(translate "Add virtual disk")" \
"2" "$(translate "Add import disk")" \
"3" "$(translate "Add Controller or NVMe (PCI passthrough)")" \
"a" "$(translate "Add virtual disk")" \
"b" "$(translate "Add import disk")" \
"c" "$(translate "Add Controller or NVMe (PCI passthrough)")" \
"r" "$(translate "Reset current storage selection")" \
"d" "$(translate "[ Finish and continue ]")" \
"d" "$(translate "──── [ Finish and continue ] ────")" \
--ok-button "Select" --cancel-button "Cancel" 3>&1 1>&2 2>&3) || {
msg_warn "$(translate "Storage plan selection cancelled.")"
return 1
}
case "$choice" in
1)
a)
select_virtual_disk
;;
2)
b)
select_import_disk
;;
3)
c)
select_controller_nvme
;;
r)
@@ -590,49 +595,6 @@ function select_virtual_disk() {
}
function select_import_disk() {
msg_info "$(translate "Detecting available disks...")"
_refresh_host_storage_cache
local FREE_DISKS=()
local DISK INFO MODEL SIZE LABEL DESCRIPTION
while read -r DISK; do
[[ "$DISK" =~ /dev/zd ]] && continue
_disk_is_host_system_used "$DISK" && continue
INFO=($(lsblk -dn -o MODEL,SIZE "$DISK"))
MODEL="${INFO[@]::${#INFO[@]}-1}"
SIZE="${INFO[-1]}"
LABEL=""
if _disk_used_in_guest_configs "$DISK"; then
LABEL+=" [⚠ $(translate "In use by VM/LXC config")]"
fi
DESCRIPTION=$(printf "%-30s %10s%s" "$MODEL" "$SIZE" "$LABEL")
if _array_contains "$DISK" "${IMPORT_DISKS[@]}"; then
FREE_DISKS+=("$DISK" "$DESCRIPTION" "ON")
else
FREE_DISKS+=("$DISK" "$DESCRIPTION" "OFF")
fi
done < <(lsblk -dn -e 7,11 -o PATH)
stop_spinner
if [[ ${#FREE_DISKS[@]} -eq 0 ]]; then
whiptail --title "Error" --msgbox "$(translate "No importable disks available. System disks and protected disks are hidden.")" 9 70
return 1
fi
local selected
selected=$(whiptail --title "Select Import Disks" --checklist \
"$(translate "Select the disks you want to import (use spacebar to toggle):")" 20 78 10 \
"${FREE_DISKS[@]}" 3>&1 1>&2 2>&3) || return 1
IMPORT_DISKS=()
local item
for item in $(echo "$selected" | tr -d '"'); do
IMPORT_DISKS+=("$item")
done
export IMPORT_DISKS
}
function select_controller_nvme() {
local VM_STORAGE_IOMMU_REBOOT_POLICY="defer"
@@ -761,7 +723,7 @@ function prompt_controller_conflict_policy() {
shift
local -a source_vms=("$@")
local msg vmid vm_name st ob
msg="$(translate "Selected controller/NVMe is already assigned to other VM(s):")\n\n"
msg="\n$(translate "Selected controller/NVMe is already assigned to other VM(s):")\n\n"
for vmid in "${source_vms[@]}"; do
vm_name=$(_vm_name_by_id "$vmid")
st="stopped"; _vm_status_is_running "$vmid" && st="running"
@@ -771,7 +733,7 @@ function prompt_controller_conflict_policy() {
msg+="\n$(translate "Choose action for this controller/NVMe:")"
local choice
choice=$(whiptail --title "$(translate "Controller/NVMe Conflict Policy")" --menu "$msg" 22 96 10 \
choice=$(whiptail --title "$(translate "Controller/NVMe Conflict Policy")" --menu "$msg" 20 80 10 \
"1" "$(translate "Keep in source VM(s) + disable onboot + add to target VM")" \
"2" "$(translate "Move to target VM (remove from source VM config)")" \
"3" "$(translate "Skip this device")" \
@@ -1398,6 +1360,7 @@ function create_vm() {
msg_ok "Configured controller/NVMe as hostpci${HOSTPCI_INDEX}: ${PCI_DEV}"
DISK_INFO="${DISK_INFO}<p>Controller/NVMe: ${PCI_DEV}</p>"
CONSOLE_DISK_INFO="${CONSOLE_DISK_INFO}- Controller/NVMe: ${PCI_DEV} (hostpci${HOSTPCI_INDEX})\n"
BOOT_ORDER_LIST+=("hostpci${HOSTPCI_INDEX}")
HOSTPCI_INDEX=$((HOSTPCI_INDEX + 1))
else
msg_error "Failed to configure controller/NVMe: ${PCI_DEV}"
@@ -1511,18 +1474,26 @@ else
echo -e "${TAB}$(translate "Then change the VM display to none (vga: none) when the system is stable.")"
fi
local HOST_REBOOT_REQUIRED="no"
local REBOOT_REASONS=""
if [[ "${VM_STORAGE_IOMMU_PENDING_REBOOT:-0}" == "1" ]]; then
HOST_REBOOT_REQUIRED="yes"
msg_warn "$(translate "IOMMU was enabled during this wizard. Reboot the host to apply it.")"
msg_ok "$(translate "IOMMU has been enabled — a system reboot is required")"
REBOOT_REASONS+="$(translate "IOMMU has been enabled on this system.")\n"
fi
if [[ "$GPU_WIZARD_REBOOT_REQUIRED" == "yes" ]]; then
HOST_REBOOT_REQUIRED="yes"
REBOOT_REASONS+="$(translate "GPU passthrough changes require a host reboot.")\n"
fi
if [[ "$HOST_REBOOT_REQUIRED" == "yes" ]]; then
if whiptail --title "$(translate "Reboot Recommended")" --yesno \
"$(translate "A host reboot is required to apply passthrough changes before starting the VM.")\n\n$(translate "Do you want to reboot now?")" 11 78; then
echo ""
if whiptail --title "$(translate "Reboot Required")" --yesno \
"\n${REBOOT_REASONS}\n$(translate "A host reboot is required before starting the VM. Reboot now?")" 13 78; then
msg_warn "$(translate "Rebooting the system...")"
reboot
else
echo ""
msg_info2 "$(translate "To use the VM without issues, the host must be restarted before starting it.")"
msg_info2 "$(translate "Do not start the VM until the system has been rebooted.")"
fi
fi
echo -e