diff options
author | Helmut Grohne <helmut@subdivi.de> | 2023-06-22 21:57:25 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2023-06-22 21:57:25 +0200 |
commit | 94f7ace2c486b0daac410becd57ab6e36be5b1c2 (patch) | |
tree | 5b871da2aba8b1b8cfc4bf362f1e617dc5233482 | |
parent | 75d79763acc9bad36536affbeece33f13dc13af5 (diff) | |
download | debvm-94f7ace2c486b0daac410becd57ab6e36be5b1c2.tar.gz |
debvm-run: expand the rootdev skip
-rwxr-xr-x | bin/debvm-run | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/bin/debvm-run b/bin/debvm-run index ead9942..d8ff174 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -52,11 +52,20 @@ Do not pass configure network card. Do not pass a random number generator device. -=item B<rootdev> +=item B<root> + +Skip all of the following tasks matching C<root/*>. +If either of these is present, the VM will not boot unless a suitable replacement is added in another way. + +=item B<root/cmd> + +Since B<debvm-run> uses B<qemu> as bootloader it normally passes the label of the root block device via the kernel command line. +This passing can be inhibited to supply a different location. + +=item B<root/dev> A block device for the root filesystem is no longer passed. This can be used to customize the block device. -The label of the root filesystem will still be passed. =back @@ -208,10 +217,15 @@ if ! printf '\123\357' | cmp --bytes=2 "$IMAGE" - 1080; then fi check_skip() { - case "$SKIP" in - *",$1,"*) return 0 ;; - *) return 1 ;; - esac + while :; do + case "$SKIP" in + *",$1,"*) return 0 ;; + esac + if test "$1" = "${1%/*}"; then + return 1 + fi + set -- "${1%/*}" + done } cleanup() { @@ -279,7 +293,10 @@ case "$IMAGE_LABEL" in ;; esac -KERNEL_CMDLINE="root=LABEL=$IMAGE_LABEL rw" +KERNEL_CMDLINE= +if ! check_skip root/cmd; then + KERNEL_CMDLINE="root=LABEL=$IMAGE_LABEL rw" +fi NETDEV="user,id=net0" KERNELFD=3 @@ -304,7 +321,7 @@ set -- \ -initrd "/proc/self/fd/$INITRDFD" \ "$@" -if ! check_skip rootdev; then +if ! check_skip root/dev; then set -- \ -drive "media=disk,format=raw,discard=unmap,file=$IMAGE,if=virtio,cache=unsafe" \ "$@" @@ -409,11 +426,11 @@ if test -z "$GRAPHICAL"; then set -- -nographic "$@" case "$KERNELARCH" in amd64|i386) - KERNEL_CMDLINE="$KERNEL_CMDLINE console=ttyS0" + KERNEL_CMDLINE="${KERNEL_CMDLINE:+"$KERNEL_CMDLINE "}console=ttyS0" ;; esac if test -t 0 && test -t 1 && test -n "$TERM"; then - KERNEL_CMDLINE="$KERNEL_CMDLINE TERM=$TERM" + KERNEL_CMDLINE="${KERNEL_CMDLINE:+"$KERNEL_CMDLINE "}TERM=$TERM" fi else case "$KERNELARCH" in @@ -440,7 +457,9 @@ DNSSEARCH=$(dnsdomainname) if test -n "$DNSSEARCH"; then NETDEV="$NETDEV,domainname=$DNSSEARCH" fi -set -- -append "$KERNEL_CMDLINE" "$@" +if test -n "$KERNEL_CMDLINE"; then + set -- -append "$KERNEL_CMDLINE" "$@" +fi if ! check_skip network; then set -- -netdev "$NETDEV" -device "$NIC_DEV" "$@" |