summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGioele Barabucci <gioele@svario.it>2023-02-02 10:17:28 +0100
committerGioele Barabucci <gioele@svario.it>2023-02-02 22:39:58 +0100
commit5aab220fffd647a29e64a674c8ef65ee72ef037b (patch)
tree82a24b736f6e63972ce0df404f3172a3a72a616a /bin
parentebd9704f6f1c6879c3300ddcf74e55cbd1fac057 (diff)
downloaddebvm-5aab220fffd647a29e64a674c8ef65ee72ef037b.tar.gz
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.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/debvm-create15
1 files changed, 13 insertions, 2 deletions
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<debvm-create> [B<-a> I<architecture>] [B<-h> I<hostname>] [B<-k> F<sshkey>] [B
=head1 DESCRIPTION
-B<debvm-create> is essentially a thin wrapper around B<mmdebstrap> for creating a raw ext4 filesystem image for booting with B<debvm-run>.
+B<debvm-create> is essentially a thin wrapper around B<mmdebstrap> for creating a raw ext4 or tar filesystem image for booting with B<debvm-run>.
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<apt>, 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"