summaryrefslogtreecommitdiff
path: root/bin/debvm-create
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-02-27 07:50:50 +0100
committerHelmut Grohne <helmut@subdivi.de>2024-02-27 07:50:50 +0100
commit12d193bb8d108f5718dc12053ccf78a1b6a876ce (patch)
tree86372629e7a0d73a82968cda3611734c84e6d8ab /bin/debvm-create
parentae025c7aba7e4cbbe794cb48de4464d0e136dfee (diff)
downloaddebvm-12d193bb8d108f5718dc12053ccf78a1b6a876ce.tar.gz
debvm-create: fix --skip ext4
We were truncating the output file after generating it. Instead, split the logic and create the file prior to running mmdebstrap to make permission failures fail early.
Diffstat (limited to 'bin/debvm-create')
-rwxr-xr-xbin/debvm-create28
1 files changed, 14 insertions, 14 deletions
diff --git a/bin/debvm-create b/bin/debvm-create
index a8d5727..0e1a969 100755
--- a/bin/debvm-create
+++ b/bin/debvm-create
@@ -409,6 +409,12 @@ else
}
fi
+if check_skip ext4; then
+ set -- "$SUITE" "$IMAGE" "$@"
+ set -x
+ exec mmdebstrap "$@"
+fi
+
TEMPROOT=
cleanup() {
if test -n "$TEMPROOT"; then
@@ -416,23 +422,17 @@ cleanup() {
fi
}
-if check_skip ext4; then
- set -- "$IMAGE" "$@"
-else
- trap cleanup EXIT
- trap 'exit 1' HUP INT QUIT TERM
- TEMPROOT="$(mktemp -d)"
-
- set -- "$TEMPROOT" "$@"
-fi
+trap cleanup EXIT
+trap 'exit 1' HUP INT QUIT TERM
+TEMPROOT="$(mktemp -d)"
-set -- "$SUITE" "$@"
+set -- "$SUITE" "$TEMPROOT" "$@"
set -ex
-mmdebstrap "$@"
-
# Create and truncate the file with "normal" permission.
: >"$IMAGE"
-check_skip ext4 ||
- run_inside_userns /sbin/mkfs.ext4 -L debvm -d "$TEMPROOT" "$IMAGE" "$SIZE"
+
+mmdebstrap "$@"
+
+run_inside_userns /sbin/mkfs.ext4 -L debvm -d "$TEMPROOT" "$IMAGE" "$SIZE"