summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--update-ddns.conf6
-rw-r--r--update-ddns.in20
2 files changed, 15 insertions, 11 deletions
diff --git a/update-ddns.conf b/update-ddns.conf
index 4d7762b..e23b084 100644
--- a/update-ddns.conf
+++ b/update-ddns.conf
@@ -1,3 +1,3 @@
-6 authToken1 eno1 dnsName1
-4 authToken2 eno1 dnsName2
-4 authToken3 http://ip-check.url
+6 updateUrl1 eno1 dnsName1
+4 updateUrl2 eno1 dnsName2
+4 updateUrl3 http://ip-check.url
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