summaryrefslogtreecommitdiff
path: root/debvm-run
diff options
context:
space:
mode:
authorJohannes Schauer Marin Rodrigues <josch@mister-muffin.de>2022-12-22 09:52:41 +0100
committerJohannes Schauer Marin Rodrigues <josch@mister-muffin.de>2022-12-22 11:47:33 +0100
commitd1c39543c259f76720a4d9c173d7d15f6fa753d7 (patch)
tree3311cb9aa70fafed00c911f1e3054ff863c665e3 /debvm-run
parentbdbae095951d18694ce787436af5643ef46e7f6b (diff)
downloaddebvm-d1c39543c259f76720a4d9c173d7d15f6fa753d7.tar.gz
give the ext4 image a disk label
- this allows the kernel cmdline and fstab to refer to it by label instead of by /dev/sda or /dev/vda (depending on whether the disk is attached to qemu via virtio or not) - it allows other consumers of the image to detect that this is an image created by debvm and then treat it accordingly
Diffstat (limited to 'debvm-run')
-rwxr-xr-xdebvm-run10
1 files changed, 9 insertions, 1 deletions
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 -- \