diff --git a/src/freedombone-freedns b/src/freedombone-freedns index f22ff2c3..6ad9cb1b 100755 --- a/src/freedombone-freedns +++ b/src/freedombone-freedns @@ -13,7 +13,7 @@ # License # ======= # -# Copyright (C) 2016 Bob Mottram +# Copyright (C) 2016-2017 Bob Mottram # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -33,9 +33,14 @@ PROJECT_NAME='freedombone' export TEXTDOMAIN=${PROJECT_NAME}-freedns export TEXTDOMAINDIR="/usr/share/locale" +VERBOSE= CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg FREEDNS_WGET='wget -q --read-timeout=0.0 --waitretry=5 --tries=4 https://freedns.afraid.org/dynamic/update.php?' +if [[ "$1" == "--verbose" || "$1" == "-v" ]]; then + VERBOSE=1 +fi + if [ ! -f $CONFIGURATION_FILE ]; then exit 0 fi @@ -47,10 +52,13 @@ function item_in_array { } detected_codes=() -codelines=($(grep "_CODE=" $CONFIGURATION_FILE | uniq)) +codelines=$(grep "_CODE=" $CONFIGURATION_FILE | uniq) for line in "${codelines[@]}" do code=$(echo "$line" | awk -F '=' '{print $2}') + if [ $VERBOSE ]; then + echo $"freedns code $code" + fi item_in_array "$code" "${detected_codes[@]}" if [[ $? != 0 ]]; then detected_codes+=("$code")