From e4a94685cc91286682cb259f80b592432704d126 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Wed, 30 May 2012 18:03:40 +0000 Subject: 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 --- rtadm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rtadm b/rtadm index 148ad99..fce24d9 100755 --- a/rtadm +++ b/rtadm @@ -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 -- cgit v1.2.3