diff --git a/common.d/build_functions.sh b/common.d/build_functions.sh index a3505ba..df6b3be 100644 --- a/common.d/build_functions.sh +++ b/common.d/build_functions.sh @@ -26,7 +26,7 @@ setup_inet() create_image() { - name="$(get_image_path "$1")" + local name="$(get_image_path "$1")" if [ -z "$2" ]; then size="$DEFAULT_IMAGE_SIZE" else @@ -41,13 +41,16 @@ create_image() log "Failed to cretae image [$name]" ierror return 1 } - mkfs.ext4 "$name" + log "Creating ext4 fs on $name" internal + mkfs.ext4 "$name" || { + log "Failed to create new fs" ierror + } } trim_image() { { - name="$1" + local name="$(get_image_path "$1")" e2fsck -f "$name" resize2fs -M "$name" } || { @@ -62,8 +65,10 @@ mount_image() { local mountdir="$(mktemp --tmpdir=./tmp/ -d)" local mountdir="$(realpath "$mountdir")" + + local name="$(get_image_path "$1")" - mount -o loop "$1" "$mountdir" || { + mount -o loop "$name" "$mountdir" || { log "Failed to mount image" ierror return 1 }