Merge pull request #12111 from jefferyto/ddns-scripts-backport-fixes-openwrt-19.07
[openwrt-19.07] ddns-scripts: Backport fixes
This commit is contained in:
commit
b8912fe4e3
5 changed files with 15 additions and 16 deletions
2
net/ddns-scripts/Makefile
Executable file → Normal file
2
net/ddns-scripts/Makefile
Executable file → Normal file
|
@ -12,7 +12,7 @@ PKG_NAME:=ddns-scripts
|
|||
PKG_VERSION:=2.7.8
|
||||
# Release == build
|
||||
# increase on changes of services files or tld_names.dat
|
||||
PKG_RELEASE:=12
|
||||
PKG_RELEASE:=13
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_MAINTAINER:=
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
. /lib/functions/network.sh
|
||||
|
||||
# GLOBAL VARIABLES #
|
||||
VERSION="2.7.8-11"
|
||||
VERSION="2.7.8-13"
|
||||
SECTION_ID="" # hold config's section name
|
||||
VERBOSE=0 # default mode is log to console, but easily changed with parameter
|
||||
MYPROG=$(basename $0) # my program call name
|
||||
|
@ -282,11 +282,11 @@ write_log() {
|
|||
[ $__LEVEL -eq 7 ] && return # no syslog for debug messages
|
||||
__CMD=$(echo -e "$__CMD" | tr -d '\n' | tr '\t' ' ') # remove \n \t chars
|
||||
[ $__EXIT -eq 1 ] && {
|
||||
eval "$__CMD" # force syslog before exit
|
||||
eval '$__CMD' # force syslog before exit
|
||||
exit 1
|
||||
}
|
||||
[ $use_syslog -eq 0 ] && return
|
||||
[ $((use_syslog + __LEVEL)) -le 7 ] && eval "$__CMD"
|
||||
[ $((use_syslog + __LEVEL)) -le 7 ] && eval '$__CMD'
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
"ddns.com.br" "http://[DOMAIN]:[PASSWORD]@members.ddns.com.br/nic/update?hostname=[DOMAIN]&myip=[IP]"
|
||||
|
||||
# "ddnss.de" "http://[USERNAME]:[PASSWORD]@ip4.ddnss.de/upd.php?host=[DOMAIN]&ip=[IP]" "good|nochg"
|
||||
"ddnss.de" "http://ip4.ddnss.de/upd.php?user=[USERNAME]&pwd=[PASSWORD]&host=[DOMAIN]&ip=[IP]" "good|nochg"
|
||||
"ddnss.de" "http://ip4.ddnss.de/upd.php?user=[USERNAME]&pwd=[PASSWORD]&host=[DOMAIN]&ip=[IP]" "Updated|No change"
|
||||
|
||||
"ddo.jp" "http://free.ddo.jp/dnsupdate.php?dn=[DOMAIN]&pw=[PASSWORD]&ip=[IP]"
|
||||
|
||||
|
@ -95,8 +95,8 @@
|
|||
|
||||
"dyndns.it" "http://[USERNAME]:[PASSWORD]@update.dyndns.it/nic/update?system=dyndns&hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
|
||||
"dyn.com" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
"dyndns.org" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
"dyn.com" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/v3/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
"dyndns.org" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/v3/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
|
||||
"dyndnss.net" "http://www.dyndnss.net/?user=[USERNAME]&pass=[PASSWORD]&domain=[DOMAIN]&updater=other"
|
||||
|
||||
|
@ -114,7 +114,7 @@
|
|||
|
||||
"goip.de" "http://www.goip.de/setip?username=[USERNAME]&password=[PASSWORD]&subdomain=[DOMAIN]&ip=[IP]"
|
||||
|
||||
"google.com" "http://[USERNAME]:[PASSWORD]@domains.google.com/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
"google.com" "https://[USERNAME]:[PASSWORD]@domains.google.com/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
|
||||
"he.net" "http://[DOMAIN]:[PASSWORD]@dyn.dns.he.net/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
|
||||
|
|
|
@ -62,9 +62,8 @@
|
|||
|
||||
"duiadns.net" "http://ip.duiadns.net/dynamic.duia?host=[DOMAIN]&password=[PASSWORD]&ip6=[IP]"
|
||||
|
||||
"dyn.com" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
|
||||
"dyndns.org" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/nic/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
"dyn.com" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/v3/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
"dyndns.org" "http://[USERNAME]:[PASSWORD]@members.dyndns.org/v3/update?hostname=[DOMAIN]&myip=[IP]" "good|nochg"
|
||||
|
||||
"dynu.com" "http://api.dynu.com/nic/update?hostname=[DOMAIN]&myipv6=[IP]&username=[USERNAME]&password=[PASSWORD]"
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ cloudflare_transfer() {
|
|||
done
|
||||
|
||||
# check for error
|
||||
grep -q '"success":true' $DATFILE || {
|
||||
grep -q '"success":\s*true' $DATFILE || {
|
||||
write_log 4 "CloudFlare reported an error:"
|
||||
write_log 7 "$(cat $DATFILE)" # report error
|
||||
return 1 # HTTP-Fehler
|
||||
|
@ -133,7 +133,7 @@ __PRGBASE="$__PRGBASE --header 'Content-Type: application/json' "
|
|||
__RUNPROG="$__PRGBASE --request GET '$__URLBASE/zones?name=$__DOMAIN'"
|
||||
cloudflare_transfer || return 1
|
||||
# extract zone id
|
||||
__ZONEID=$(grep -o '"id":"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
||||
__ZONEID=$(grep -o '"id":\s*"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
||||
[ -z "$__ZONEID" ] && {
|
||||
write_log 4 "Could not detect 'zone id' for domain.tld: '$__DOMAIN'"
|
||||
return 127
|
||||
|
@ -143,14 +143,14 @@ __ZONEID=$(grep -o '"id":"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
|||
__RUNPROG="$__PRGBASE --request GET '$__URLBASE/zones/$__ZONEID/dns_records?name=$__HOST&type=$__TYPE'"
|
||||
cloudflare_transfer || return 1
|
||||
# extract record id
|
||||
__RECID=$(grep -o '"id":"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
||||
__RECID=$(grep -o '"id":\s*"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
||||
[ -z "$__RECID" ] && {
|
||||
write_log 4 "Could not detect 'record id' for host.domain.tld: '$__HOST'"
|
||||
return 127
|
||||
}
|
||||
|
||||
# extract current stored IP
|
||||
__DATA=$(grep -o '"content":"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
||||
__DATA=$(grep -o '"content":\s*"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
||||
|
||||
# check data
|
||||
[ $use_ipv6 -eq 0 ] \
|
||||
|
@ -178,7 +178,7 @@ __DATA=$(grep -o '"content":"[^"]*' $DATFILE | grep -o '[^"]*$' | head -1)
|
|||
# update is needed
|
||||
# let's build data to send
|
||||
# set proxied parameter
|
||||
__PROXIED=$(grep -o '"proxied":[^",]*' $DATFILE | grep -o '[^:]*$')
|
||||
__PROXIED=$(grep -o '"proxied":\s*[^",]*' $DATFILE | grep -o '[^:]*$')
|
||||
|
||||
# use file to work around " needed for json
|
||||
cat > $DATFILE << EOF
|
||||
|
|
Loading…
Reference in a new issue