From 247d7c1f55ca676367382c90d1ed244f0f0c4af1 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 12 Jun 2024 22:58:16 +0200 Subject: [PATCH] Update disk.sh --- src/disk.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/disk.sh b/src/disk.sh index 6e374b0..681da93 100644 --- a/src/disk.sh +++ b/src/disk.sh @@ -280,10 +280,10 @@ convertDisk() { isCow "$FS" && DISK_PARAM+=",nocow=on" if [[ "$DST_FMT" != "raw" ]]; then - if [[ "$ALLOCATE" == [Nn]* ]]; then - CONV_FLAGS+=" -c" - fi - [ -n "$DISK_FLAGS" ] && DISK_PARAM+=",$DISK_FLAGS" + if [[ "$ALLOCATE" == [Nn]* ]]; then + CONV_FLAGS+=" -c" + fi + [ -n "$DISK_FLAGS" ] && DISK_PARAM+=",$DISK_FLAGS" fi # shellcheck disable=SC2086 @@ -293,13 +293,13 @@ convertDisk() { fi if [[ "$DST_FMT" == "raw" ]]; then - if [[ "$ALLOCATE" != [Nn]* ]]; then - # Work around qemu-img bug - CUR_SIZE=$(stat -c%s "$TMP_FILE") - if ! fallocate -l "$CUR_SIZE" "$TMP_FILE"; then - error "Failed to allocate $CUR_SIZE bytes for $DISK_DESC image $TMP_FILE" - fi + if [[ "$ALLOCATE" != [Nn]* ]]; then + # Work around qemu-img bug + CUR_SIZE=$(stat -c%s "$TMP_FILE") + if ! fallocate -l "$CUR_SIZE" "$TMP_FILE"; then + error "Failed to allocate $CUR_SIZE bytes for $DISK_DESC image $TMP_FILE" fi + fi fi rm -f "$SOURCE_FILE"