diff options
author | Helmut Grohne <helmut@subdivi.de> | 2024-02-27 07:50:50 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2024-02-27 07:50:50 +0100 |
commit | 12d193bb8d108f5718dc12053ccf78a1b6a876ce (patch) | |
tree | 86372629e7a0d73a82968cda3611734c84e6d8ab | |
parent | ae025c7aba7e4cbbe794cb48de4464d0e136dfee (diff) | |
download | debvm-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.
-rwxr-xr-x | bin/debvm-create | 28 | ||||
-rw-r--r-- | debian/control | 2 |
2 files changed, 15 insertions, 15 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" diff --git a/debian/control b/debian/control index 0474049..341e8a7 100644 --- a/debian/control +++ b/debian/control @@ -20,7 +20,6 @@ Depends: qemu-kvm (>> 1:8.0) | qemu-system-any, # Required for -device virtio-net-pci,netdev=net0 ipxe-qemu, - uidmap, Recommends: arch-test, file, @@ -29,6 +28,7 @@ Recommends: qemu-system, qemu-user-static, seabios, + uidmap, Suggests: qemu-system-gui, Description: create and run virtual machines for various Debian releases and architectures |