diff options
author | Rosen Penev <rosenp@gmail.com> | 2020-04-29 02:08:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 02:08:50 -0700 |
commit | 2f7ce61037f78328d67d890fbe89efa404608f29 (patch) | |
tree | 3ca68c339e128facc5f668cf6aa72afab0e9d9c2 | |
parent | a205d8af2c20cc17d5e366e3d3f09220fc5c11a6 (diff) | |
parent | 88b03577c43b5b5c1cb97a3892914e2e222c5008 (diff) |
Merge pull request #11989 from cherrot/ddns-cloudflare-v4
ddns-scripts: cloudflare.com-v4: Fix grep pattern
-rwxr-xr-x | net/ddns-scripts/Makefile | 2 | ||||
-rwxr-xr-x | net/ddns-scripts/files/update_cloudflare_com_v4.sh | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile index 6886b4ac2..fcea36ce9 100755 --- a/net/ddns-scripts/Makefile +++ b/net/ddns-scripts/Makefile @@ -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:=18 +PKG_RELEASE:=19 PKG_LICENSE:=GPL-2.0 PKG_MAINTAINER:= diff --git a/net/ddns-scripts/files/update_cloudflare_com_v4.sh b/net/ddns-scripts/files/update_cloudflare_com_v4.sh index 7e663ac42..7394187fa 100755 --- a/net/ddns-scripts/files/update_cloudflare_com_v4.sh +++ b/net/ddns-scripts/files/update_cloudflare_com_v4.sh @@ -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 |