diff options
Diffstat (limited to 'bin/debvm-run')
-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 f2b4587..a4a0890 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. @@ -105,6 +111,7 @@ set -u IMAGE=rootfs.ext4 GRAPHICAL= +CMDLINE_APPEND= NETOPTS= nth_arg() { @@ -132,6 +139,9 @@ usage_error() { usage } +opt_append() { + CMDLINE_APPEND="${CMDLINE_APPEND:+$CMDLINE_APPEND }$1" +} opt_graphical() { GRAPHICAL=1 } @@ -158,12 +168,12 @@ while getopts :gi:s:-: OPTCHAR; do graphical) "opt_$OPTARG" ;; - image|netopt|sshport) + append|image|netopt|sshport) test "$OPTIND" -gt "$#" && usage_error "missing argument for --$OPTARG" "opt_$OPTARG" "$(nth_arg "$OPTIND" "$@")" OPTIND=$((OPTIND+1)) ;; - image=*|netopt=*|sshport=*) + append=*|image=*|netopt=*|sshport=*) "opt_${OPTARG%%=*}" "${OPTARG#*=}" ;; *) @@ -407,7 +417,7 @@ if test -n "$DNSSEARCH"; then NETOPTS=",domainname=$DNSSEARCH$NETOPTS" fi set -- \ - -append "$KERNEL_CMDLINE" \ + -append "$KERNEL_CMDLINE${CMDLINE_APPEND:+ $CMDLINE_APPEND}" \ -netdev "user,id=net0$NETOPTS" \ -device "$NIC_DEV" \ "$@" |