summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rwxr-xr-xdebvm-create4
-rwxr-xr-xdebvm-run10
3 files changed, 15 insertions, 6 deletions
diff --git a/README.md b/README.md
index 6331652..fd1c8cc 100644
--- a/README.md
+++ b/README.md
@@ -40,9 +40,10 @@ installed:
What is this image format precisely?
====================================
-The image is a sparse ext4 file system image. It contains the root filesystem
-of a (Debian) installation including an init system and a kernel. There is no
-partition table or bootloader. The following paths are assumed inside:
+The image is a sparse ext4 file system image with a disk label "debvm". It
+contains the root filesystem of a (Debian) installation including an init
+system and a kernel. There is no partition table or bootloader. The following
+paths are assumed inside:
* `/bin/true` is used to detect the architecture of an image
* `/vmlinuz` must be a symbolic link pointing to a regular file containing
the kernel.
diff --git a/debvm-create b/debvm-create
index 11e145c..c44b67d 100755
--- a/debvm-create
+++ b/debvm-create
@@ -122,7 +122,7 @@ set -- \
"$@"
# unless we set up a fstab, / will be read-only
-set -- "--customize-hook=echo '/dev/vda / ext4 defaults 0 1' >"'"$1/etc/fstab"' "$@"
+set -- "--customize-hook=echo 'LABEL=debvm / ext4 defaults 0 1' >"'"$1/etc/fstab"' "$@"
# set up a hostname
set -- \
@@ -176,4 +176,4 @@ mmdebstrap "$@"
truncate -s "$SIZE" "$IMAGE"
/sbin/resize2fs "$IMAGE"
-/sbin/tune2fs -i 0 -O extents,uninit_bg,dir_index,has_journal "$IMAGE"
+/sbin/tune2fs -L debvm -i 0 -O extents,uninit_bg,dir_index,has_journal "$IMAGE"
diff --git a/debvm-run b/debvm-run
index 4ec9122..9b26a76 100755
--- a/debvm-run
+++ b/debvm-run
@@ -46,6 +46,14 @@ done
test -f "$IMAGE" || die "image '$IMAGE' not found"
test -s "$IMAGE" || die "image '$IMAGE' is empty"
+if ! printf '\123\357' | cmp --bytes=2 "$IMAGE" - 1080; then
+ die "image '$IMAGE' is not in ext4 format"
+fi
+
+if ! printf 'debvm\000' | cmp --bytes=6 "$IMAGE" - 1144; then
+ die "image '$IMAGE' was not created by debvm-create (wrong disk label)"
+fi
+
cleanup() {
set +x
test -n "$KERNELTMP" && rm -f "$KERNELTMP"
@@ -78,7 +86,7 @@ INITRDNAME=$(/sbin/debugfs "$IMAGE" -R "stat initrd.img" | sed 's/Fast link dest
test -n "$KERNELNAME" || die "failed to discover kernel image"
test -n "$INITRDNAME" || die "failed to discover initrd image"
-KERNEL_CMDLINE="root=/dev/vda rw"
+KERNEL_CMDLINE="root=LABEL=debvm rw"
NETDEV="user,id=net0"
set -- \