From fa5ea829180cda5a1fd91bc9e9f28ebe55a2793d Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Tue, 5 Oct 2010 19:23:07 +0000 Subject: rapid-tunneling: remove bashism, simplify Replace complex (and bash-specific) loop with a simpler non-loop. git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@8435 283159da-0705-0410-b60c-f2062b4bb6ad --- rapid-tunneling | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/rapid-tunneling b/rapid-tunneling index b86510e..f015960 100755 --- a/rapid-tunneling +++ b/rapid-tunneling @@ -26,7 +26,6 @@ if [ -r /etc/rapid-tunneling/client ]; then . /etc/rapid-tunneling/client; fi opt_host='' opt_port='' -opt_tunnelport='' # For completeness opt_user='' while getopts b:h:p:u: opt; do @@ -43,15 +42,10 @@ shift $((OPTIND - 1)) tmpdir=`mktemp -d rapid-tunneling.XXXXXX` mkdir $tmpdir/recv $tmpdir/send tar xzf "$1" -C $tmpdir/recv - -for arg in host port user tunnelport; do - opt_arg=opt_$arg - if [ "${!opt_arg}" ]; then - eval $arg="${!opt_arg}" - else - eval $arg=`cat $tmpdir/recv/$arg` - fi -done +[ "$opt_host" ] && host="$opt_host" || host=`cat $tmpdir/recv/host` +[ "$opt_port" ] && port="$opt_port" || port=`cat $tmpdir/recv/port` +[ "$opt_user" ] && user="$opt_user" || user=`cat $tmpdir/recv/user` +tunnelport=`cat $tmpdir/recv/tunnelport` ssh-keygen -q -t rsa -C rapid-tunneling -N "" -f $tmpdir/send/key # public will be in key.pub cp $tmpdir/recv/key $tmpdir/send/origkey -- cgit v1.2.3