diff options
| author | Yves-Alexis Perez <corsac@debian.org> | 2014-03-11 20:48:48 +0100 |
|---|---|---|
| committer | Yves-Alexis Perez <corsac@debian.org> | 2014-03-11 20:48:48 +0100 |
| commit | b96bc2fcc06cc6c1762dc193a5117ebcb956e220 (patch) | |
| tree | 4915ecb47936524433c6578526cc5d25a0d2913c /testing/ssh | |
| parent | 4a7efb286aaf809849d56841b59c2d733e8dff49 (diff) | |
| parent | 15fb7904f4431a6e7c305fd08732458f7f885e7e (diff) | |
| download | vyos-strongswan-b96bc2fcc06cc6c1762dc193a5117ebcb956e220.tar.gz vyos-strongswan-b96bc2fcc06cc6c1762dc193a5117ebcb956e220.zip | |
Merge tag 'upstream/5.1.2'
Upstream version 5.1.2
Diffstat (limited to 'testing/ssh')
| -rwxr-xr-x | testing/ssh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/testing/ssh b/testing/ssh new file mode 100755 index 000000000..95d064c15 --- /dev/null +++ b/testing/ssh @@ -0,0 +1,37 @@ +#!/bin/bash + +DIR=$(dirname `readlink -f $0`) +. $DIR/testing.conf +SSHCONF="-F $DIR/ssh_config" + +if [ $# == 0 ] +then + echo "$0 <host>" + exit 1 +fi + +host=$1 +echo "$host" | grep -q "^\([0-9]\+\.\|[0-9a-fA-F]\+:\).*" +if [ $? -eq 0 ] +then + # assume we got an ip address + ip=$host +else + pos='$1' + echo "$host" | grep -q ".*1$" + if [ $? -eq 0 ] + then + # {host}1, use second address + pos='$2' + host=`echo "$host" | sed -n -e "s/1$//p"` + fi + ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, "{ print ${pos} }" | awk '{ print $1 }'`" + if [ -z $ip ] + then + echo "Host '$host' unknown" + exit 1 + fi +fi + +shift +exec ssh $SSHCONF -q root@$ip $@ |
