summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-10-03 21:34:07 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2010-10-03 21:34:07 +0000
commit24bbb7371c52aa93d676104b36c35be87ef5c8b6 (patch)
tree8e79b9dd494350be559a3aaff00dc85438c2735a
parentec76e19f80c852f3e351d0e333b7cc3aed074d2a (diff)
place files under $HOME/.rapid-tunneling
Switch to using $HOME/.rapid-tunneling as the base directory for files we need to keep (instead of simply using $HOME). git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@8399 283159da-0705-0410-b60c-f2062b4bb6ad
-rwxr-xr-xrapid-tunneling8
-rwxr-xr-xrapid-tunneling-status4
2 files changed, 8 insertions, 4 deletions
diff --git a/rapid-tunneling b/rapid-tunneling
index cf1b277..8146948 100755
--- a/rapid-tunneling
+++ b/rapid-tunneling
@@ -9,6 +9,7 @@ fi
if [ -r /etc/rapid-tunneling/client ]; then . /etc/rapid-tunneling/client; fi
+base_dir="$HOME/.rapid-tunneling"
tmpdir=`mktemp -d rapid-tunneling.XXXXXX`
mkdir $tmpdir/recv $tmpdir/send
tar xzf "$1" -C $tmpdir/recv
@@ -20,8 +21,9 @@ 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
-cp $tmpdir/recv/key $HOME/key
-tar czf $HOME/ra-params.tar.gz -C $tmpdir/send key origkey
+mkdir -p $base_dir
+cp $tmpdir/recv/key $base_dir/key
+tar czf $base_dir/ra-params.tar.gz -C $tmpdir/send key origkey
mkdir -p -m 700 $HOME/.ssh
awk '$NF != "rapid-tunneling" {print}' $HOME/.ssh/authorized_keys > $HOME/.ssh/authorized_keys.new 2>/dev/null || true
@@ -38,4 +40,4 @@ else
SSD="/sbin/busybox start-stop-daemon"
fi
-$SSD -S -b -m -p $HOME/pid -x /bin/sh -- -c "exec ssh -o 'StrictHostKeyChecking no' -o 'BatchMode yes' -o 'ServerAliveInterval 60' -T -p $port -i $HOME/key -R $tunnelport:127.0.0.1:22 -l $user $host < $HOME/ra-params.tar.gz"
+$SSD -S -b -m -p $base_dir/pid -x /bin/sh -- -c "exec ssh -o 'StrictHostKeyChecking no' -o 'BatchMode yes' -o 'ServerAliveInterval 60' -T -p $port -i $base_dir/key -R $tunnelport:127.0.0.1:22 -l $user $host < $base_dir/ra-params.tar.gz"
diff --git a/rapid-tunneling-status b/rapid-tunneling-status
index e270ea1..8040616 100755
--- a/rapid-tunneling-status
+++ b/rapid-tunneling-status
@@ -1,5 +1,7 @@
#!/bin/sh
+base_dir="$HOME/.rapid-tunneling"
+
if [ "$1" = "--help" ]; then
echo "Usage: $0 [-p] [<pid-file>]" 1>&2
echo " -p: Print only pid of SSH process (if connecting or connected)." 1>&2
@@ -18,7 +20,7 @@ elif [ "$1" = "-s" ]; then
shift
fi
pidfile="$1"
-[ -z "$pidfile" ] && pidfile="$HOME/pid"
+[ -z "$pidfile" ] && pidfile="$base_dir/pid"
connected()
{