summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2023-06-22 22:00:03 +0200
committerHelmut Grohne <helmut@subdivi.de>2023-06-22 22:00:03 +0200
commit6e42dece4f4baac74fe6148a7016c6aece32068e (patch)
treee12ec4f070877c2d538cea0e7b444f3ef03b4929
parent652b43980ed5a24dbc9cc9714e419c330d7963ec (diff)
parent460dbb513d953e7864c88ae831e6431792c306e0 (diff)
downloaddebvm-6e42dece4f4baac74fe6148a7016c6aece32068e.tar.gz
Merge qemu-append into main
-rwxr-xr-xbin/debvm-run16
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" \
"$@"