From 9f116f79f7d82c694b0d414bde1286ef177cf531 Mon Sep 17 00:00:00 2001 From: juronja <101410098+juronja@users.noreply.github.com> Date: Fri, 13 Feb 2026 13:12:00 +0000 Subject: [PATCH 01/10] updated udateable and os flags --- frontend/public/json/truenas-vm.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/public/json/truenas-vm.json b/frontend/public/json/truenas-vm.json index 7f11e7564..f35151a32 100644 --- a/frontend/public/json/truenas-vm.json +++ b/frontend/public/json/truenas-vm.json @@ -6,7 +6,7 @@ ], "date_created": "2026-01-16", "type": "vm", - "updateable": true, + "updateable": false, "privileged": false, "interface_port": null, "documentation": "https://www.truenas.com/docs/", @@ -22,7 +22,7 @@ "cpu": 2, "ram": 8192, "hdd": 16, - "os": null, + "os": "Debian", "version": null } } From 989580629a0856a0aa613c59479537e5d5c22dcc Mon Sep 17 00:00:00 2001 From: juronja <101410098+juronja@users.noreply.github.com> Date: Fri, 13 Feb 2026 13:12:41 +0000 Subject: [PATCH 02/10] preselect latest stable ISO fix --- vm/truenas-vm.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index 295dc6954..8d2447ade 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -293,16 +293,26 @@ function advanced_settings() { done ISOARRAY=() + local last_stable_index=0 + local current_item=0 + while read -r ISOPATH; do FILENAME=$(basename "$ISOPATH") ISOARRAY+=("$ISOPATH" "$FILENAME" "OFF") + if [[ ! "$FILENAME" =~ (RC|BETA) ]]; then + last_stable_index=$(((current_item * 3) + 2)) + fi + ((current_item++)) done < <(truenas_iso_lookup | sort -V) + + ISOARRAY[$last_stable_index]="ON" + if [ ${#ISOARRAY[@]} -eq 0 ]; then echo "No ISOs found." exit 1 fi - if SELECTED_ISO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT ISO TO INSTALL" --notags --radiolist "\nSelect version (BETA/RC + Latest stables):" 20 58 12 "${ISOARRAY[@]}" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if SELECTED_ISO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT ISO TO INSTALL" --notags --radiolist "\nSelect version (BETA/RC/Latest stable):" 20 58 12 "${ISOARRAY[@]}" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then echo -e "${ISO}${BOLD}${DGN}ISO Chosen: ${BGN}$(basename "$SELECTED_ISO")${CL}" else exit-script From c997910d5854da1bb2d9d10418841956f758b40c Mon Sep 17 00:00:00 2001 From: juronja <101410098+juronja@users.noreply.github.com> Date: Fri, 13 Feb 2026 13:22:13 +0000 Subject: [PATCH 03/10] order of operations fix --- vm/truenas-vm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index 8d2447ade..be8b90f28 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -305,13 +305,13 @@ function advanced_settings() { ((current_item++)) done < <(truenas_iso_lookup | sort -V) - ISOARRAY[$last_stable_index]="ON" - if [ ${#ISOARRAY[@]} -eq 0 ]; then echo "No ISOs found." exit 1 fi + ISOARRAY[$last_stable_index]="ON" + if SELECTED_ISO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT ISO TO INSTALL" --notags --radiolist "\nSelect version (BETA/RC/Latest stable):" 20 58 12 "${ISOARRAY[@]}" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then echo -e "${ISO}${BOLD}${DGN}ISO Chosen: ${BGN}$(basename "$SELECTED_ISO")${CL}" else From e23854399358287f4a075e138a7f729940941104 Mon Sep 17 00:00:00 2001 From: juronja <101410098+juronja@users.noreply.github.com> Date: Fri, 13 Feb 2026 13:35:40 +0000 Subject: [PATCH 04/10] fallback If no stable was found --- vm/truenas-vm.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index be8b90f28..88c9ceddc 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -310,6 +310,10 @@ function advanced_settings() { exit 1 fi + if [ "$last_stable_index" -eq -1 ]; then + last_stable_index=$(( (${#ISOARRAY[@]}) - 1 )) + fi + ISOARRAY[$last_stable_index]="ON" if SELECTED_ISO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT ISO TO INSTALL" --notags --radiolist "\nSelect version (BETA/RC/Latest stable):" 20 58 12 "${ISOARRAY[@]}" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then From 872eda28a0a988cfd71713289d241832e563f24a Mon Sep 17 00:00:00 2001 From: juronja <101410098+juronja@users.noreply.github.com> Date: Fri, 13 Feb 2026 13:55:46 +0000 Subject: [PATCH 05/10] added variables instead of hardcoded values --- vm/truenas-vm.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index 88c9ceddc..f8f8cc60e 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -273,6 +273,12 @@ function default_settings() { } function advanced_settings() { + DISK_SIZE="16" + HN="truenas" + CORE_COUNT="2" + RAM_SIZE="8192" + BRG="vmbr0" + METHOD="advanced" [ -z "${VMID:-}" ] && VMID=$(get_valid_nextid) while true; do @@ -293,7 +299,7 @@ function advanced_settings() { done ISOARRAY=() - local last_stable_index=0 + local last_stable_index=-1 local current_item=0 while read -r ISOPATH; do @@ -334,9 +340,8 @@ function advanced_settings() { exit-script fi - if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 truenas --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if VM_NAME=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set Hostname" 8 58 "$HN" --title "HOSTNAME" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if [ -z $VM_NAME ]; then - HN="truenas" echo -e "${HOSTNAME}${BOLD}${DGN}Hostname: ${BGN}$HN${CL}" else HN=$(echo ${VM_NAME,,} | tr -d ' ') @@ -364,7 +369,7 @@ function advanced_settings() { exit-script fi - if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 2 --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if CORE_COUNT=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate CPU Cores" 8 58 "$CORE_COUNT" --title "CORE COUNT" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if [ -z $CORE_COUNT ]; then CORE_COUNT="2" echo -e "${CPUCORE}${BOLD}${DGN}CPU Cores: ${BGN}$CORE_COUNT${CL}" @@ -375,7 +380,7 @@ function advanced_settings() { exit-script fi - if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 8192 --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if RAM_SIZE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Allocate RAM in MiB" 8 58 "$RAM_SIZE" --title "RAM" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if [ -z $RAM_SIZE ]; then RAM_SIZE="8192" echo -e "${RAMSIZE}${BOLD}${DGN}RAM Size: ${BGN}$RAM_SIZE${CL}" @@ -386,7 +391,7 @@ function advanced_settings() { exit-script fi - if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 vmbr0 --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then + if BRG=$(whiptail --backtitle "Proxmox VE Helper Scripts" --inputbox "Set a Bridge" 8 58 "$BRG" --title "BRIDGE" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then if [ -z $BRG ]; then BRG="vmbr0" echo -e "${BRIDGE}${BOLD}${DGN}Bridge: ${BGN}$BRG${CL}" From 02398c167e4751a52354384e4da79f5c57b8fb74 Mon Sep 17 00:00:00 2001 From: juronja <101410098+juronja@users.noreply.github.com> Date: Fri, 13 Feb 2026 14:03:47 +0000 Subject: [PATCH 06/10] preincrement --- vm/truenas-vm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index f8f8cc60e..4984ef794 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -308,7 +308,7 @@ function advanced_settings() { if [[ ! "$FILENAME" =~ (RC|BETA) ]]; then last_stable_index=$(((current_item * 3) + 2)) fi - ((current_item++)) + ((++current_item)) done < <(truenas_iso_lookup | sort -V) if [ ${#ISOARRAY[@]} -eq 0 ]; then From a004ae98dd92dfee89759cc31a583d25dfbc9c18 Mon Sep 17 00:00:00 2001 From: juronja <101410098+juronja@users.noreply.github.com> Date: Fri, 13 Feb 2026 14:09:44 +0000 Subject: [PATCH 07/10] reversed the preselect logic --- vm/truenas-vm.sh | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index 4984ef794..5c17ac51a 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -299,29 +299,15 @@ function advanced_settings() { done ISOARRAY=() - local last_stable_index=-1 - local current_item=0 - while read -r ISOPATH; do FILENAME=$(basename "$ISOPATH") ISOARRAY+=("$ISOPATH" "$FILENAME" "OFF") - if [[ ! "$FILENAME" =~ (RC|BETA) ]]; then - last_stable_index=$(((current_item * 3) + 2)) - fi - ((++current_item)) done < <(truenas_iso_lookup | sort -V) - if [ ${#ISOARRAY[@]} -eq 0 ]; then echo "No ISOs found." exit 1 fi - if [ "$last_stable_index" -eq -1 ]; then - last_stable_index=$(( (${#ISOARRAY[@]}) - 1 )) - fi - - ISOARRAY[$last_stable_index]="ON" - if SELECTED_ISO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT ISO TO INSTALL" --notags --radiolist "\nSelect version (BETA/RC/Latest stable):" 20 58 12 "${ISOARRAY[@]}" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then echo -e "${ISO}${BOLD}${DGN}ISO Chosen: ${BGN}$(basename "$SELECTED_ISO")${CL}" else From 4a0824777aa0fb3f8d5eab50e80566f75e25fb6c Mon Sep 17 00:00:00 2001 From: juronja <101410098+juronja@users.noreply.github.com> Date: Fri, 13 Feb 2026 14:16:51 +0000 Subject: [PATCH 08/10] second attempt to preselect last item --- vm/truenas-vm.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index 5c17ac51a..76e6697b7 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -299,15 +299,26 @@ function advanced_settings() { done ISOARRAY=() - while read -r ISOPATH; do - FILENAME=$(basename "$ISOPATH") - ISOARRAY+=("$ISOPATH" "$FILENAME" "OFF") - done < <(truenas_iso_lookup | sort -V) - if [ ${#ISOARRAY[@]} -eq 0 ]; then + # Fetch and sort the ISO paths into a bash array + mapfile -t ALL_ISOS < <(truenas_iso_lookup | sort -V) + ISO_COUNT=${#ALL_ISOS[@]} + + if [ $ISO_COUNT -eq 0 ]; then echo "No ISOs found." exit 1 fi + for i in "${!ALL_ISOS[@]}"; do + ISOPATH="${ALL_ISOS[$i]}" + FILENAME=$(basename "$ISOPATH") + # Pre-select only the last item in the list + if [ "$i" -eq "$((ISO_COUNT - 1))" ]; then + ISOARRAY+=("$ISOPATH" "$FILENAME" "ON") + else + ISOARRAY+=("$ISOPATH" "$FILENAME" "OFF") + fi + done + if SELECTED_ISO=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT ISO TO INSTALL" --notags --radiolist "\nSelect version (BETA/RC/Latest stable):" 20 58 12 "${ISOARRAY[@]}" --cancel-button Exit-Script 3>&1 1>&2 2>&3); then echo -e "${ISO}${BOLD}${DGN}ISO Chosen: ${BGN}$(basename "$SELECTED_ISO")${CL}" else From 8ffbe015f19f22cbd2628bd153caf4c4e929ebe6 Mon Sep 17 00:00:00 2001 From: juronja <101410098+juronja@users.noreply.github.com> Date: Fri, 13 Feb 2026 14:23:54 +0000 Subject: [PATCH 09/10] preselect only stable releases --- vm/truenas-vm.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index 76e6697b7..be23309b6 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -299,7 +299,6 @@ function advanced_settings() { done ISOARRAY=() - # Fetch and sort the ISO paths into a bash array mapfile -t ALL_ISOS < <(truenas_iso_lookup | sort -V) ISO_COUNT=${#ALL_ISOS[@]} @@ -308,11 +307,24 @@ function advanced_settings() { exit 1 fi + # Identify the index of the last stable release + LAST_STABLE_INDEX=-1 + for i in "${!ALL_ISOS[@]}"; do + if [[ ! "${ALL_ISOS[$i]}" =~ (BETA|RC) ]]; then + LAST_STABLE_INDEX=$i + fi + done + + # Build the whiptail array for i in "${!ALL_ISOS[@]}"; do ISOPATH="${ALL_ISOS[$i]}" FILENAME=$(basename "$ISOPATH") - # Pre-select only the last item in the list - if [ "$i" -eq "$((ISO_COUNT - 1))" ]; then + + # Select ON if it's the last stable found, OR fallback to last item if no stable exists + if [[ "$i" -eq "$LAST_STABLE_INDEX" ]]; then + ISOARRAY+=("$ISOPATH" "$FILENAME" "ON") + elif [[ "$LAST_STABLE_INDEX" -eq -1 && "$i" -eq "$((ISO_COUNT - 1))" ]]; then + # Fallback: if somehow no stable is found, select the very last item ISOARRAY+=("$ISOPATH" "$FILENAME" "ON") else ISOARRAY+=("$ISOPATH" "$FILENAME" "OFF") From ed547dc464f8ae25c66ef171b34d864ce811b695 Mon Sep 17 00:00:00 2001 From: juronja <101410098+juronja@users.noreply.github.com> Date: Sat, 14 Feb 2026 10:04:13 +0000 Subject: [PATCH 10/10] using udevadm to get device serial --- vm/truenas-vm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/truenas-vm.sh b/vm/truenas-vm.sh index b2380db43..4eef6f398 100644 --- a/vm/truenas-vm.sh +++ b/vm/truenas-vm.sh @@ -568,7 +568,7 @@ if [ "$IMPORT_DISKS" == "yes" ]; then for SELECTION in $SELECTIONS; do ((++SCSI_NR)) - ID_SERIAL=$(echo "$SELECTION" | rev | cut -d'_' -f1 | rev) + ID_SERIAL=$(udevadm info --query=property --value --property=ID_SERIAL_SHORT "/dev/disk/by-id/$SELECTION") ID_SERIAL=${ID_SERIAL:0:20} qm set $VMID --scsi$SCSI_NR /dev/disk/by-id/$SELECTION,serial=$ID_SERIAL