diff --git a/path/make-image-raw b/path/make-image-raw index c0d72bb..7919ad9 100755 --- a/path/make-image-raw +++ b/path/make-image-raw @@ -1,8 +1,11 @@ #!/usr/bin/env bash set -e -if - export DISK_IMAGE="$2" - export ROOT_MOUNT="$OPUS_OUTPUT/mount" +export DISK_IMAGE="$2" +export ROOT_MOUNT="$1-mount" +set +e + +( + set -e # Get the approximate size required for the image export DISK_SIZE=$(du -sb "$1" | cut -f1) @@ -44,7 +47,7 @@ if mount "${DISK_LOOP}p2" "$ROOT_MOUNT" # Add files - dupe "$1/." "$ROOT_MOUNT" + cp -a "$1/." "$ROOT_MOUNT" # Make fstab echo "UUID=$(blkid -o value -s UUID "${DISK_LOOP}p1") none swap sw 0 0" >"$ROOT_MOUNT/etc/fstab" @@ -60,10 +63,8 @@ if umount -l "$ROOT_MOUNT" rmdir "$ROOT_MOUNT" losetup -d "$DISK_LOOP" -then - set +e -else - set +e +) +if [ $? != 0 ]; then echo echo Script execution ended due to error. Cleaning up... umount -l "$ROOT_MOUNT"