Merge pull request #2531 from moose-kazan/master

Fix for dns_vultr.sh
This commit is contained in:
neil 2019-10-06 20:13:19 +08:00 committed by GitHub
commit 95dd7b5323
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -106,9 +106,9 @@ _get_root() {
domain=$1 domain=$1
i=1 i=1
while true; do while true; do
h=$(printf "%s" "$domain" | cut -d . -f $i-100) _domain=$(printf "%s" "$domain" | cut -d . -f $i-100)
_debug h "$h" _debug h "$_domain"
if [ -z "$h" ]; then if [ -z "$_domain" ]; then
return 1 return 1
fi fi
@ -119,11 +119,9 @@ _get_root() {
if printf "%s\n" "$response" | grep '^\[.*\]' >/dev/null; then if printf "%s\n" "$response" | grep '^\[.*\]' >/dev/null; then
if _contains "$response" "\"domain\":\"$_domain\""; then if _contains "$response" "\"domain\":\"$_domain\""; then
_sub_domain="$(echo "$fulldomain" | sed "s/\\.$_domain\$//")" _sub_domain="$(echo "$fulldomain" | sed "s/\\.$_domain\$//")"
_domain=$_domain
return 0 return 0
else else
_err 'Invalid domain' _debug "Go to next level of $_domain"
return 1
fi fi
else else
_err "$response" _err "$response"