diff options
author | Erich Eckner <git@eckner.net> | 2019-04-01 09:11:03 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-04-01 09:11:03 +0200 |
commit | 4db6582f5883d684fd316211faf5af58f9a79729 (patch) | |
tree | 2bc3d9b2eadd2947f622f0daec333f0b34e05a7d | |
parent | ed9464dae9a1cab898a2555c752442e2cfcdb47c (diff) | |
download | update-ddns-4db6582f5883d684fd316211faf5af58f9a79729.tar.xz |
update-ddns.in: more style updates
-rw-r--r-- | update-ddns.in | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/update-ddns.in b/update-ddns.in index 72e89a7..7aef624 100644 --- a/update-ddns.in +++ b/update-ddns.in @@ -99,9 +99,9 @@ for dnsName in $( \ updateUrl="${updateUrls[${j}]}" if [[ "${dnsName}" == *'/'* ]]; then - dnsIps="$( + dnsIps=$( curl ${ipCmdVers[${j}]} "${dnsName}" 2> /dev/null - )" + ) ips='1' updateIps="${updateIps}"',auto' if [ -n "${curlForceIpVer}" ] && [ "${curlForceIpVer}" != "${ipCmdVers[${j}]}" ]; then @@ -110,27 +110,26 @@ for dnsName in $( \ fi curlForceIpVer="${ipCmdVers[${j}]}" else - dnsIps="$( + dnsIps=$( dig $1 "${dnsName}" ${dnsVers[${j}]} | \ sed '/^;; AUTHORITY SECTION:$/Q' | \ grep '^[^;]' | \ grep "\s${dnsVers[${j}]}\s" | \ awk '{print $5}' | \ sort -u - )" + ) - ips="$( + ips=$( "${ipCmd}" -o ${ipCmdVers[${j}]} addr show scope global | \ awk '{print $4}' | \ cut -d/ -f1 | \ grep -vx "${ignoreIps}" | \ sort -u - )" + ) if [ $(echo "${ips}" | grep -c '.') -eq 0 ]; then updateIps="${updateIps}"',auto' - if [ -n "${curlForceIpVer}" ] && [ "${curlForceIpVer}" != "${ipCmdVers[${j}]}" ] - then + if [ -n "${curlForceIpVer}" ] && [ "${curlForceIpVer}" != "${ipCmdVers[${j}]}" ]; then >&2 echo 'Error: I cannot determine two different ip versions automatically (because Erich didn'"'"'t need it).' exit 1 fi |