Update import-disk-image.sh

This commit is contained in:
MacRimi 2025-05-30 14:56:57 +02:00 committed by GitHub
parent f721d9d774
commit a6c2b958a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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