mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-24 14:11:42 +00:00
Also don't use sed
This commit is contained in:
parent
b91c0a0616
commit
db3043553c
@ -53,6 +53,7 @@ dns_unoeuro_add() {
|
|||||||
|
|
||||||
if ! _contains "$response" "$_sub_domain" >/dev/null; then
|
if ! _contains "$response" "$_sub_domain" >/dev/null; then
|
||||||
_info "Adding record"
|
_info "Adding record"
|
||||||
|
|
||||||
if _uno_rest POST "my/products/$h/dns/records" "{\"name\":\"$fulldomain\",\"type\":\"TXT\",\"data\":\"$txtvalue\",\"ttl\":120}"; then
|
if _uno_rest POST "my/products/$h/dns/records" "{\"name\":\"$fulldomain\",\"type\":\"TXT\",\"data\":\"$txtvalue\",\"ttl\":120}"; then
|
||||||
if _contains "$response" "\"status\": 200" >/dev/null; then
|
if _contains "$response" "\"status\": 200" >/dev/null; then
|
||||||
_info "Added, OK"
|
_info "Added, OK"
|
||||||
@ -65,7 +66,9 @@ dns_unoeuro_add() {
|
|||||||
_err "Add txt record error."
|
_err "Add txt record error."
|
||||||
else
|
else
|
||||||
_info "Updating record"
|
_info "Updating record"
|
||||||
record_id=$(echo "$response" | sed -n -e "/$_sub_domain/{x;p;d;}" -e x | _head_n -1 | _egrep_o "[0-9]{1,}")
|
record_line_number=$(echo "$response" | grep -n "$_sub_domain" | cut -d : -f 1)
|
||||||
|
record_line_number=$(($record_line_number-1))
|
||||||
|
record_id=$(echo "$response" | _head_n "$record_line_number" | _tail_n 1 1 | _egrep_o "[0-9]{1,}")
|
||||||
_debug "record_id" "$record_id"
|
_debug "record_id" "$record_id"
|
||||||
|
|
||||||
_uno_rest PUT "my/products/$h/dns/records/$record_id" "{\"name\":\"$fulldomain\",\"type\":\"TXT\",\"data\":\"$txtvalue\",\"ttl\":120}"
|
_uno_rest PUT "my/products/$h/dns/records/$record_id" "{\"name\":\"$fulldomain\",\"type\":\"TXT\",\"data\":\"$txtvalue\",\"ttl\":120}"
|
||||||
@ -76,7 +79,6 @@ dns_unoeuro_add() {
|
|||||||
_err "Update error"
|
_err "Update error"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#fulldomain txtvalue
|
#fulldomain txtvalue
|
||||||
@ -120,7 +122,9 @@ dns_unoeuro_rm() {
|
|||||||
if ! _contains "$response" "$_sub_domain" >/dev/null; then
|
if ! _contains "$response" "$_sub_domain" >/dev/null; then
|
||||||
_info "Don't need to remove."
|
_info "Don't need to remove."
|
||||||
else
|
else
|
||||||
record_id=$(echo "$response" | sed -n -e "/$_sub_domain/{x;p;d;}" -e x | _head_n -1 | _egrep_o "[0-9]{1,}")
|
record_line_number=$(echo "$response" | grep -n "$_sub_domain" | cut -d : -f 1)
|
||||||
|
record_line_number=$(($record_line_number-1))
|
||||||
|
record_id=$(echo "$response" | _head_n "$record_line_number" | _tail_n 1 1 | _egrep_o "[0-9]{1,}")
|
||||||
_debug "record_id" "$record_id"
|
_debug "record_id" "$record_id"
|
||||||
|
|
||||||
if [ -z "$record_id" ]; then
|
if [ -z "$record_id" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user