diff options
author | Helmut Grohne <helmut@subdivi.de> | 2023-06-22 22:30:30 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2023-06-22 22:30:30 +0200 |
commit | f9f5d74144b11ebb6df156549365453ea426e379 (patch) | |
tree | 149afecdf9b34cce2e16fc416ce44dfeb91f2a93 | |
parent | 7d1734785df8d922eb5da75111afb4903b90ca23 (diff) | |
download | debvm-f9f5d74144b11ebb6df156549365453ea426e379.tar.gz |
debvm-run: restore behaviour of repeated --sshport flags
When issuing multiple --sshport options, the last one should win.
Fixes: a2db07766257 ("debvm-run: add a --netopt option to customize the -netdev")
-rwxr-xr-x | bin/debvm-run | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/debvm-run b/bin/debvm-run index a4a0890..1019ac7 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -113,6 +113,7 @@ IMAGE=rootfs.ext4 GRAPHICAL= CMDLINE_APPEND= NETOPTS= +SSHPORT= nth_arg() { shift "$1" @@ -152,7 +153,7 @@ opt_netopt() { NETOPTS="$NETOPTS,$1" } opt_sshport() { - opt_netopt "hostfwd=tcp:127.0.0.1:$1-:22" + SSHPORT=$1 } while getopts :gi:s:-: OPTCHAR; do @@ -194,6 +195,10 @@ while getopts :gi:s:-: OPTCHAR; do done shift "$((OPTIND - 1))" +if test -n "$SSHPORT"; then + opt_netopt "hostfwd=tcp:127.0.0.1:$SSHPORT-:22" +fi + test -f "$IMAGE" || die "image '$IMAGE' not found" test -s "$IMAGE" || die "image '$IMAGE' is empty" |