diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2012-05-30 18:03:40 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2012-05-30 18:03:40 +0000 |
commit | e4a94685cc91286682cb259f80b592432704d126 (patch) | |
tree | b15eb5a0a220e1f2438f74049c2373961d60161c /rtadm | |
parent | e4783dd9468a755f843a9db5235e386446a63e26 (diff) |
rtadm: check for config settings on create only
We only need to make sure HOSTNAME and PORT were set in the configuration
file for the command 'create'. No need to check for them elsewhere.
git-svn-id: svn+ssh://xorcom/home/svn/debs/components/rapid-tunneling@10612 283159da-0705-0410-b60c-f2062b4bb6ad
Diffstat (limited to 'rtadm')
-rwxr-xr-x | rtadm | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -8,10 +8,12 @@ CFG_FILE=/etc/rapid-tunneling/rtadm if [ -r $CFG_FILE ]; then . $CFG_FILE; fi -if [ -z "$HOSTNAME" -o -z "$PORT" ]; then - echo "ERROR: Hostname or port not set in configuration file $CFG_FILE." 1>&2 - exit 1 -fi +verify_config_is_set() { + if [ -z "$HOSTNAME" -o -z "$PORT" ]; then + echo "ERROR: Hostname or port not set in configuration file $CFG_FILE." 1>&2 + exit 1 + fi +} create() { @@ -19,6 +21,7 @@ create() TUNNEL_PORT=$1 COMMENT=$2 + verify_config_is_set if grep -q "ra-[0-9]\+-$COMMENT-[0-9]\+" $HOME/.ssh/authorized_keys 2>/dev/null; then echo "Connection name '$COMMENT' already exists. Aborting." 1>&2 |