summaryrefslogtreecommitdiff
path: root/update-ddns.in
diff options
context:
space:
mode:
Diffstat (limited to 'update-ddns.in')
-rw-r--r--update-ddns.in20
1 files changed, 12 insertions, 8 deletions
diff --git a/update-ddns.in b/update-ddns.in
index 4779654..6626ed4 100644
--- a/update-ddns.in
+++ b/update-ddns.in
@@ -18,24 +18,22 @@ then
done
fi
-while read -r ipVer authToken dev dnsName
+while read -r ipVer updateUrl dev dnsName
do
- if [[ "${ipVer}" = "#"* ]] || [ -z "${ipVer}" ]
+ if [[ "${ipVer}" = '#'* ]] || [ -z "${ipVer}" ]
then
continue
fi
- if [ ${ipVer} == "4" ]
+ if [ "${ipVer}" == "4" ]
then
dnsVer="A"
inetVer="inet"
- syncPre=""
- elif [ ${ipVer} == "6" ]
+ elif [ "${ipVer}" == "6" ]
then
dnsVer="AAAA"
inetVer="inet6"
- syncPre="v6."
else
>&2 echo 'Error: First column in "#ETCDIR#/update-ddns.conf" needs to be "4" or "6"!'
exit 1
@@ -67,7 +65,13 @@ do
if [ $(echo "${ips}" | wc -l) -eq 1 ]
then
- updateIp='?address='"${ips}"
+ updateIp='address='"${ips}"
+ if [[ "${updateUrl}" = *'?'* ]]
+ then
+ updateIp='&'"${updateIp}"
+ else
+ updateIp='?'"${updateIp}"
+ fi
else
unset updateIp
fi
@@ -82,7 +86,7 @@ do
uniq -d
)" ]
then
- curl -${ipVer} -sS "https://${syncPre}sync.afraid.org/u/${authToken}/${updateIp}" 2> /dev/null
+ curl -${ipVer} -sS "${updateUrl}${updateIp}" 2> /dev/null
fi
done < #ETCDIR#/update-ddns.conf