aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-04-22 14:27:34 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-04-22 14:27:34 -0300
commite442e44b17e016b9c5674f2adc7a9065997809ed (patch)
tree59574059383bb2a605ae093d11e49c0a469d7e1f
parent83edbb621bd1706cbbd1db29a0cf32b62b32b036 (diff)
downloadkvmx-e442e44b17e016b9c5674f2adc7a9065997809ed.tar.gz
kvmx-e442e44b17e016b9c5674f2adc7a9065997809ed.tar.bz2
Moves SSH user option to SSH_OPTS
-rwxr-xr-xkvmx20
1 files changed, 10 insertions, 10 deletions
diff --git a/kvmx b/kvmx
index 7fd6ffe..8dff4b8 100755
--- a/kvmx
+++ b/kvmx
@@ -61,7 +61,7 @@ function kvmx_app_base {
# Build a SSH command
function __kvmx_ssh_command {
# See http://blog.djm.net.au/2013/11/chacha20-and-poly1305-in-openssh.html
- SSH_OPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=FATAL -o ProxyCommand=none -o Ciphers=chacha20-poly1305@openssh.com -i $1"
+ SSH_OPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=FATAL -o ProxyCommand=none -o Ciphers=chacha20-poly1305@openssh.com -o User=$SSH_LOGIN -i $1"
SSH_COMMAND="ssh $SSH_OPTS"
SCP_COMMAND="scp $SSH_OPTS"
}
@@ -330,7 +330,7 @@ function kvmx_up {
let ssh_attempts="0"
echo -n "Waiting for machine to boot..."
while true; do
- echo true | $SSH_COMMAND -o ConnectTimeout=2 -o NumberOfPasswordPrompts=0 -p $SSH $SSH_LOGIN@127.0.0.1 &> /dev/null && break
+ echo true | $SSH_COMMAND -o ConnectTimeout=2 -o NumberOfPasswordPrompts=0 -p $SSH 127.0.0.1 &> /dev/null && break
echo -n "."
let ssh_attempts++
@@ -372,7 +372,7 @@ function kvmx_hostname {
fi
echo "Setting hostname..."
- $SSH_COMMAND -o ConnectTimeout=2 -p $SSH $SSH_LOGIN@127.0.0.1 <<EOF
+ $SSH_COMMAND -o ConnectTimeout=2 -p $SSH 127.0.0.1 <<EOF
##### BEGIN REMOTE SCRIPT #####
OLD_HOST="\$(hostname)"
@@ -446,7 +446,7 @@ function kvmx_ssh {
fi
SSH="`cat $SSHFILE`"
- $SSH_COMMAND -p $SSH $SSH_LOGIN@127.0.0.1 $*
+ $SSH_COMMAND -p $SSH 127.0.0.1 $*
}
# Suspend the virtual machine
@@ -569,7 +569,7 @@ function kvmx_rsync {
ORIG="$3"
DEST="$4"
SSH="`cat $SSHFILE`"
- rsync -av -e "$SSH_COMMAND -o Port=$SSH" --rsync-path "sudo rsync" $ORIG/ $SSH_LOGIN@127.0.0.1:$DEST/
+ rsync -av -e "$SSH_COMMAND -o Port=$SSH" --rsync-path "sudo rsync" $ORIG/ 127.0.0.1:$DEST/
}
# Copy files from the guest
@@ -592,7 +592,7 @@ function kvmx_scp_from {
ORIG="$(echo $ORIG | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
fi
- $SCP_COMMAND -o Port=$SSH -o User=$SSH_LOGIN 127.0.0.1:$ORIG $DEST
+ $SCP_COMMAND -o Port=$SSH 127.0.0.1:$ORIG $DEST
}
# Copy files to the guest
@@ -615,7 +615,7 @@ function kvmx_scp_to {
DEST="$(echo $DEST | sed -e "s|^$HOME|/home/$SSH_LOGIN|")"
fi
- $SCP_COMMAND -o Port=$SSH -o User=$SSH_LOGIN $ORIG 127.0.0.1:$DEST
+ $SCP_COMMAND -o Port=$SSH $ORIG 127.0.0.1:$DEST
}
# List guests
@@ -807,7 +807,7 @@ function kvmx_provision {
echo "Syncing provision files into the guest..."
echo "sudo mkdir -p `dirname $DEST`" | kvmx_ssh
- rsync -av -e "$SSH_COMMAND -o Port=$SSH" $provision_rsync_opts --rsync-path "sudo rsync" $ORIG/ $SSH_LOGIN@127.0.0.1:$DEST/
+ rsync -av -e "$SSH_COMMAND -o Port=$SSH" $provision_rsync_opts --rsync-path "sudo rsync" $ORIG/ 127.0.0.1:$DEST/
fi
echo "Running provision command inside the guest..."
@@ -883,9 +883,9 @@ function kvmx_xpra {
fi
if [ "$action" == "start" ] || [ "$action" == "attach" ]; then
- nohup xpra $action --ssh="$SSH_COMMAND -p $SSH" ssh:$SSH_LOGIN@127.0.0.1 $* &> $XPRALOG < /dev/null &
+ nohup xpra $action --ssh="$SSH_COMMAND -p $SSH" ssh:127.0.0.1 $* &> $XPRALOG < /dev/null &
else
- xpra $action --ssh="$SSH_COMMAND -p $SSH" ssh:$SSH_LOGIN@127.0.0.1 $*
+ xpra $action --ssh="$SSH_COMMAND -p $SSH" ssh:127.0.0.1 $*
fi
}