From b936fce5fb6889ca2fe4b4095a98d73ee6f6515e Mon Sep 17 00:00:00 2001 From: Stuart Howlette Date: Thu, 19 Mar 2020 14:59:50 +0000 Subject: [PATCH] Removed extra --ssh-port option, supply port from --ssh option instead --- README.md | 5 ++--- quickemu.sh | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f77c27c..009cb69 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,6 @@ You can also pass optional parameters --snapshot : Create a disk snapshot. --virgil : Use virgil, if available. --ssh : Enable SSH to the machine (disabled by default). - --ssh-port : Local port to forward to the machine (default 2222). ``` ### SSH Access @@ -84,12 +83,12 @@ SSH access to the QEMU virtual machine can be enabled by using the `--ssh` flag. This does not install or start an SSH server within the guest itself, so you may need to enable this on a per-guest basis. For Ubuntu guests, you can enable this by installing `openssh-server`. -If the default port overlaps with another service on your host, you can override this with `--ssh-port $PORT`. This will still forward to port `TCP22` on the guest machine. +If the default port overlaps with another service on your host, you can override this with `--ssh $PORT`. This will still forward to port `TCP22` on the guest machine. Example of usage: - ``` -$ ./quickemu.sh --vm mate.conf --ssh --ssh-port 1111 +$ ./quickemu.sh --vm mate.conf --ssh 1111 Starting mate.conf - BIOS: Legacy - Disk: /home/$USER/Applications/quickemu/ubuntu-mate/focal-desktop-amd64.qcow2 diff --git a/quickemu.sh b/quickemu.sh index 0bb76e1..e15643f 100755 --- a/quickemu.sh +++ b/quickemu.sh @@ -184,7 +184,6 @@ function usage() { echo " --snapshot : Create a disk snapshot." echo " --virgil : Use virgil, if available." echo " --ssh : Enable SSH to the machine (disabled by default)." - echo " --ssh-port : Local port to forward to the machine (default 2222)." exit 1 } @@ -196,7 +195,6 @@ ENGINE="system-x86_64" RESTORE=0 SNAPSHOT=0 SSH=0 -SSH_PORT=2222 VM="" while [ $# -gt 0 ]; do @@ -218,10 +216,12 @@ while [ $# -gt 0 ]; do shift;; -ssh|--ssh) SSH=1 - shift;; - -ssh-port|--ssh-port) - SSH_PORT=$2 - shift + if [[ $2 =~ ^[0-9]+$ ]]; then + SSH_PORT=$2 + shift + else + SSH_PORT=2222 + fi shift;; -vm|--vm) VM="$2"