diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2010-10-05 19:23:07 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2010-10-05 19:23:07 +0000 |
commit | fa5ea829180cda5a1fd91bc9e9f28ebe55a2793d (patch) | |
tree | 5234df4915459847f775fe3327e51b7c54ac218b | |
parent | 86ea1c16c2b59904d45fab83f5a078949ffd0799 (diff) |
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
-rwxr-xr-x | rapid-tunneling | 14 |
1 files 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 |