summaryrefslogtreecommitdiff
path: root/bin/debvm-create
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2023-02-03 09:16:21 +0100
committerHelmut Grohne <helmut@subdivi.de>2023-02-03 09:16:21 +0100
commit69ea90a73785cde10035c2ab36322e2466ff7ba2 (patch)
tree212363a7f764e6432b6699cfa8d0b985fb73d451 /bin/debvm-create
parentebd9704f6f1c6879c3300ddcf74e55cbd1fac057 (diff)
parentd070d8d6ce3516f6f1bdbf2e18253528c20fd341 (diff)
downloaddebvm-69ea90a73785cde10035c2ab36322e2466ff7ba2.tar.gz
Merge branch tar-output into main
Closes: !29
Diffstat (limited to 'bin/debvm-create')
-rwxr-xr-xbin/debvm-create19
1 files changed, 18 insertions, 1 deletions
diff --git a/bin/debvm-create b/bin/debvm-create
index 8c86eca..41a6139 100755
--- a/bin/debvm-create
+++ b/bin/debvm-create
@@ -69,6 +69,12 @@ Skips adding a the customize-autologin.sh to B<mmdebstrap> that configures
automatic root login on a serial console and also parses the C<TERM> kernel
cmdline and passes it as C<TERM> to B<agetty>.
+=item B<ext4>
+
+Internally, B<mmdebstrap> creates a tar archive first and converts that to ext2, which is then upgraded to ext4.
+This option causes the conversion to ext2 and further steps to be skipped and the output image will be a tar archive instead.
+Such a tar archive is not suitable for being booted by B<debvm-run>.
+
=item B<kernel>
skips installing a linux kernel image.
@@ -229,11 +235,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 +305,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"