mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-14 02:32:47 +00:00
dont update txt, only add
This commit is contained in:
parent
daa6d8fd6c
commit
c1444ac61f
@ -30,39 +30,18 @@ dns_zone_add() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_debug "Getting txt records"
|
_debug "Adding txt record"
|
||||||
_debug _domain "$_domain"
|
|
||||||
|
|
||||||
_zone_rest GET "dns/${_domain}/txt"
|
if _zone_rest POST "dns/${_domain}/txt" "{\"name\": \"$fulldomain\", \"destination\": \"$txtvalue\"}"; then
|
||||||
|
if printf -- "%s" "$response" | grep "$fulldomain" >/dev/null; then
|
||||||
if printf "%s" "$response" | grep \"error\" >/dev/null; then
|
_info "Added, OK"
|
||||||
_err "Error"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
count=$(printf "%s\n" "$response" | _egrep_o "\"name\":\"$fulldomain\"" | wc -l)
|
|
||||||
_debug count "$count"
|
|
||||||
if [ "$count" = "0" ]; then
|
|
||||||
if _zone_rest POST "dns/${_domain}/txt" "{\"name\": \"$fulldomain\", \"destination\": \"$txtvalue\"}"; then
|
|
||||||
if printf -- "%s" "$response" | grep "$fulldomain" >/dev/null; then
|
|
||||||
_info "Added, OK"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
_err "Adding txt record error."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
_err "Adding txt record error."
|
|
||||||
else
|
|
||||||
_info "Updating record"
|
|
||||||
record_id=$(printf "%s\n" "$response" | _egrep_o "\"id\":\"[^\"]*\",\"resource_url\":\"[^\"]*\",\"name\":\"$fulldomain\"," | cut -d : -f4 | cut -d , -f1 | tr -d \" | head -n 1)
|
|
||||||
_zone_rest PUT "dns/${_domain}/txt/$record_id" "{\"name\": \"$fulldomain\", \"destination\": \"$txtvalue\"}"
|
|
||||||
if [ "$?" = "0" ]; then
|
|
||||||
_info "Updated, OK"
|
|
||||||
return 0
|
return 0
|
||||||
|
else
|
||||||
|
_err "Adding txt record error."
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
_err "Update error"
|
else
|
||||||
return 1
|
_err "Adding txt record error."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user