From 5aab220fffd647a29e64a674c8ef65ee72ef037b Mon Sep 17 00:00:00 2001 From: Gioele Barabucci Date: Thu, 2 Feb 2023 10:17:28 +0100 Subject: debvm-create: Output image in tar format if step "ext4" is skipped Outputting the image in tar format breaks interoperability with `debvm-run`, but makes it easier to inspect, convert or perform additional modifications of the generated image. --- bin/debvm-create | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'bin/debvm-create') diff --git a/bin/debvm-create b/bin/debvm-create index 8c86eca..4651e00 100755 --- a/bin/debvm-create +++ b/bin/debvm-create @@ -15,7 +15,7 @@ B [B<-a> I] [B<-h> I] [B<-k> F] [B =head1 DESCRIPTION -B is essentially a thin wrapper around B for creating a raw ext4 filesystem image for booting with B. +B is essentially a thin wrapper around B for creating a raw ext4 or tar filesystem image for booting with B. The purpose of these images primarily is testing the different releases and architectures without access to a physical machine of that architecture. Beyond essential packages, the image will contain B, an init system and a suitable kernel package. Notably absent is a bootloader and a partition table. @@ -229,11 +229,17 @@ if ! check_skip kernel; then set -- "--customize-hook=$SHARE_DIR/customize-kernel.sh" "$@" fi +MMFORMAT=ext2 +# output a tarball if the ext4 step is skipped +if check_skip ext4; then + MMFORMAT=tar +fi + # construct mmdebstrap options as $@: set -- \ --verbose \ --variant=apt \ - --format=ext2 \ + "--format=$MMFORMAT" \ --include=init \ "--architecture=$ARCHITECTURE" \ '--customize-hook=echo "LABEL=debvm / ext4 defaults 0 1" >"$1/etc/fstab"' \ @@ -293,6 +299,11 @@ set -ex mmdebstrap "$@" +{ set +x; } 2>/dev/null +check_skip ext4 && exit + +set -x + truncate -s ">$SIZE" "$IMAGE" /sbin/tune2fs -L debvm -c 0 -i 0 -O dir_index,dir_nlink,extents,extra_isize,flex_bg,has_journal,huge_file "$IMAGE" /sbin/resize2fs -b "$IMAGE" -- cgit v1.2.3