wok rev 13539

ajaxterm: add telnet support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Oct 27 21:59:58 2012 +0200 (2012-10-27)
parents 15c36eea64cb
children 105056b6bc58
files ajaxterm/stuff/usr/share/ajaxterm/login
line diff
     1.1 --- a/ajaxterm/stuff/usr/share/ajaxterm/login	Fri Oct 26 13:09:58 2012 +0200
     1.2 +++ b/ajaxterm/stuff/usr/share/ajaxterm/login	Sat Oct 27 21:59:58 2012 +0200
     1.3 @@ -17,8 +17,9 @@
     1.4  
     1.5  # Get SSH server
     1.6  server=""
     1.7 -if [ -x /usr/bin/ssh ]; then
     1.8 -	echo -n "SSH server: "
     1.9 +if [ -x /usr/bin/ssh -o -x /usr/bin/telnet ]; then
    1.10 +	echo "Expected format [!][telnet/][user@][host][:port], default local login."
    1.11 +	echo -n "TELNET/SSH server: "
    1.12  	read -t 300 server || exit 1
    1.13  fi
    1.14  
    1.15 @@ -26,9 +27,11 @@
    1.16  [ -n "$server" ] || exec /bin/login
    1.17  
    1.18  # Allow non default SSH port with format server:port
    1.19 +port=""
    1.20  sshport=""
    1.21  case "$server" in
    1.22 -*:*)	sshport="-p ${server#*:}"
    1.23 +*:*)	port="${server#*:}"
    1.24 +	sshport="-p $port"
    1.25  	server=${server%:*};;
    1.26  esac
    1.27  
    1.28 @@ -43,7 +46,7 @@
    1.29  
    1.30  # Get SSH user if missing
    1.31  case "$server" in
    1.32 -*@*)	;;
    1.33 +*/*|*@*)	;;
    1.34  *)	echo -n "$server login: "
    1.35  	read -t 30 user || exit 1
    1.36  	server="$user@$server";;
    1.37 @@ -52,4 +55,7 @@
    1.38  # Launch OpenSSH or Dropbear
    1.39  sshargs="-oPreferredAuthentications=keyboard-interactive,password -oNoHostAuthenticationForLocalhost=yes -oLogLevel=FATAL -F/dev/null";
    1.40  [ -L /usr/bin/ssh ] && sshargs=""
    1.41 -exec ssh $sshport $sshargs $server
    1.42 +case "$server" in
    1.43 +*/*)	exec ${server%/*} ${server#*/} $port ;;
    1.44 +*)	exec ssh $sshport $sshargs $server ;;
    1.45 +esac