Skip to content

Commit 8c6f285

Browse files
authored
Merge pull request #1473 from juronja/truenas-vm-whiptail-box-size-fix
Truenas-vm: Truncating text for longer checkbox items
2 parents 56aaae7 + edb291b commit 8c6f285

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

vm/truenas-vm.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,10 +560,14 @@ if [ "$IMPORT_DISKS" == "yes" ]; then
560560
SCSI_NR=0
561561

562562
while read -r LSOUTPUT; do
563-
DISKARRAY+=("$LSOUTPUT" "" "OFF")
563+
TRUNCATED="${LSOUTPUT:0:45}"
564+
if [ ${#LSOUTPUT} -gt 45 ]; then
565+
TRUNCATED="${TRUNCATED}..."
566+
fi
567+
DISKARRAY+=("$LSOUTPUT" "$TRUNCATED" "OFF")
564568
done < <(ls /dev/disk/by-id | grep -E '^ata-|^nvme-|^usb-' | grep -v 'part')
565569

566-
SELECTIONS=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT DISKS TO IMPORT" --checklist "\nSelect disk IDs to import. (Use Spacebar to select)\n" --cancel-button "Exit Script" 20 58 10 "${DISKARRAY[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit
570+
SELECTIONS=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT DISKS TO IMPORT" --checklist "\nSelect disk IDs to import. (Use Spacebar to select)\n" --notags --cancel-button "Exit Script" 20 58 10 "${DISKARRAY[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit
567571

568572
for SELECTION in $SELECTIONS; do
569573
((++SCSI_NR))

0 commit comments

Comments
 (0)