diff --git a/scripts/storage/import-disk-image.sh b/scripts/storage/import-disk-image.sh index f601aa9..e85d86f 100644 --- a/scripts/storage/import-disk-image.sh +++ b/scripts/storage/import-disk-image.sh @@ -154,12 +154,20 @@ for IMAGE in $SELECTED_IMAGES; do if [ "$IMPORT_STATUS" -eq 0 ]; then msg_ok "$(translate 'Image imported successfully')" + IMPORTED_DISK=$(cat "$TEMP_DISK_FILE") rm -f "$TEMP_DISK_FILE" - + + + if [[ "$IMPORTED_DISK" != *:* ]]; then + IMPORTED_DISK="${STORAGE}:${IMPORTED_DISK##*/}" + fi + if [ -n "$IMPORTED_DISK" ]; then EXISTING_DISKS=$(qm config "$VMID" | grep -oP "${INTERFACE}\d+" | sort -n) NEXT_SLOT=0 + + [[ -n "$EXISTING_DISKS" ]] && NEXT_SLOT=$(( $(echo "$EXISTING_DISKS" | tail -n1 | sed "s/${INTERFACE}//") + 1 )) SSD_OPTION="" @@ -191,4 +199,4 @@ done msg_ok "$(translate 'All selected images have been processed')" msg_success "$(translate "Press Enter to return to menu...")" -read -r \ No newline at end of file +read -r