File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / testing / ssh
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Jun 3 09:46:45 2020 UTC (4 years, 4 months ago) by misho
Branches: strongswan, MAIN
CVS tags: v5_9_2p0, v5_8_4p7, HEAD
Strongswan

    1: #!/bin/bash
    2: 
    3: DIR=$(dirname `readlink -f $0`)
    4: . $DIR/testing.conf
    5: SSHCONF="-F $DIR/ssh_config"
    6: 
    7: if [ $# == 0 ]
    8: then
    9: 	echo "$0 <host>"
   10: 	exit 1
   11: fi
   12: 
   13: host=$1
   14: echo "$host" | grep -q "^\([0-9]\+\.\|[0-9a-fA-F]\+:\).*"
   15: if [ $? -eq 0 ]
   16: then
   17: 	# assume we got an ip address
   18: 	ip=$host
   19: else
   20: 	pos='$1'
   21: 	echo "$host" | grep -q ".*1$"
   22: 	if [ $? -eq 0 ]
   23: 	then
   24: 		# {host}1, use second address
   25: 		pos='$2'
   26: 		host=`echo "$host" | sed -n -e "s/1$//p"`
   27: 	fi
   28: 	ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, "{ print ${pos} }" | awk '{ print $1 }'`"
   29: 	if [ -z $ip ]
   30: 	then
   31: 		echo "Host '$host' unknown"
   32: 		exit 1
   33: 	fi
   34: fi
   35: 
   36: shift
   37: exec ssh $SSHCONF -q root@$ip $@

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>