summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/debvm-run18
1 files changed, 12 insertions, 6 deletions
diff --git a/bin/debvm-run b/bin/debvm-run
index 9cfce7f..53bfb3b 100755
--- a/bin/debvm-run
+++ b/bin/debvm-run
@@ -14,7 +14,7 @@ B<debvm-run> [B<-g>] [B<-i> F<image>] [B<-s> I<sshport>] [B<--> I<qemu options>]
=head1 DESCRIPTION
B<debvm-run> is essentially a thin wrapper around B<qemu> for running a virtual machine image created by B<debvm-create> or something compatible.
-The virtual machine image is expected to be a raw ext4 image with file system label B<debvm>.
+The virtual machine image is expected to be a raw ext4 image with a non-empty file system label.
The architecture of the machine is detected from the contained F</bin/true>.
It must contain a symbolic link pointing to a kernel image at one of F<(|/boot)/vmlinu[xz]> a symbolic link pointing to an initrd image at F<initrd.img> in the same directory as the kernel image.
Both are extracted and passed to B<qemu>.
@@ -173,10 +173,6 @@ 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"
@@ -231,7 +227,17 @@ if command -v file >/dev/null 2>&1; then
esac
fi
-KERNEL_CMDLINE="root=LABEL=debvm rw"
+IMAGE_LABEL="$(/sbin/e2label "$IMAGE")"
+case "$IMAGE_LABEL" in
+ "")
+ die "debvm-run requires a non-empty filesystem label"
+ ;;
+ *" "*)
+ die "debvm-run requires a filesystem label without spaces"
+ ;;
+esac
+
+KERNEL_CMDLINE="root=LABEL=$IMAGE_LABEL rw"
NETDEV="user,id=net0"
set -- \