diff options
author | Helmut Grohne <helmut@subdivi.de> | 2023-06-22 22:00:03 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2023-06-22 22:00:03 +0200 |
commit | 6e42dece4f4baac74fe6148a7016c6aece32068e (patch) | |
tree | e12ec4f070877c2d538cea0e7b444f3ef03b4929 | |
parent | 652b43980ed5a24dbc9cc9714e419c330d7963ec (diff) | |
parent | 460dbb513d953e7864c88ae831e6431792c306e0 (diff) | |
download | debvm-6e42dece4f4baac74fe6148a7016c6aece32068e.tar.gz |
Merge qemu-append into main
-rwxr-xr-x | bin/debvm-run | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/bin/debvm-run b/bin/debvm-run index ddd6d1f..fe38a7a 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -24,6 +24,12 @@ A net interface configured for user mode is added automatically. =over 8 +=item B<--append>=I<cmdline> + +While the kernel command line can be modified by passing B<-append> to B<qemu> directly, doing that always replaces the entire command line and thus removes important values passed by B<debvm-run>. +This variant instead appends given command line arguments to the automatic ones. +Repeated use also causes appending rather than replacement. + =item B<-g>, B<--graphical> By default, the option B<-nographic> is passed to B<qemu> and one interacts with the serial console of the machine. @@ -96,6 +102,7 @@ set -u IMAGE=rootfs.ext4 SSHPORT= GRAPHICAL= +CMDLINE_APPEND= nth_arg() { shift "$1" @@ -122,6 +129,9 @@ usage_error() { usage } +opt_append() { + CMDLINE_APPEND="${CMDLINE_APPEND:+$CMDLINE_APPEND }$1" +} opt_graphical() { GRAPHICAL=1 } @@ -145,12 +155,12 @@ while getopts :gi:s:-: OPTCHAR; do graphical) "opt_$OPTARG" ;; - image|sshport) + append|image|sshport) test "$OPTIND" -gt "$#" && usage_error "missing argument for --$OPTARG" "opt_$OPTARG" "$(nth_arg "$OPTIND" "$@")" OPTIND=$((OPTIND+1)) ;; - image=*|sshport=*) + append=|image=*|sshport=*) "opt_${OPTARG%%=*}" "${OPTARG#*=}" ;; *) @@ -398,7 +408,7 @@ if test -n "$DNSSEARCH"; then NETDEV="$NETDEV,domainname=$DNSSEARCH" fi set -- \ - -append "$KERNEL_CMDLINE" \ + -append "$KERNEL_CMDLINE${CMDLINE_APPEND:+ $CMDLINE_APPEND}" \ -netdev "$NETDEV" \ -device "$NIC_DEV" \ "$@" |