From 145028d51882deb8f8efacb0c8f74677b544fd8f Mon Sep 17 00:00:00 2001 From: Daniel Steglich Date: Tue, 3 Mar 2015 22:35:28 +0100 Subject: [PATCH] added function to replace vars from update URL --- actions/dynamicdns | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/actions/dynamicdns b/actions/dynamicdns index fb5df74c6..30a8ff309 100755 --- a/actions/dynamicdns +++ b/actions/dynamicdns @@ -153,6 +153,16 @@ doReadCFG() fi } +doReplaceVars() +{ + local url=`echo ${updateurl} | sed "s//${wanip}/g"` + url=`echo ${url} | sed "s//${host}/g"` + url=`echo ${url} | sed "s//${user}/g"` + url=`echo ${url} | sed "s//${pass}/g"` + url=`echo ${url} | sed "s/'//g"` + updateurl=$url +} + doStatus() { PROC=$(pgrep ${TOOLNAME}) @@ -226,7 +236,16 @@ doUpdate() fi if [ ! -z ${updateurl} ];then - echo "todo" + doReplaceVars + + if [ "${basicauth}" = "enabled" ];then + wgetoptions=" --user $user --password $pass " + fi + if [ "${ignoreCertError}" = "enabled" ];then + wgetoptions=" --no-check-certificate " + fi + + $WGET ${wgetoptions} ${updateurl} fi } @@ -241,6 +260,7 @@ case ${cmd} in doWriteCFG ;; start) + doGetWANIP if [ "$(cat $HELPERCFG |grep ^NAT | awk '{print $2}')" = "no" ];then #if we are not behind a NAT device and we use gnudip, start the daemon tool if [ -f ${CFG} -a ! -z $(cat ${cfgfile} 2> /dev/null |grep server |cut -d = -f 2 |grep -v ^\'\')];then