|
@ -17,8 +17,7 @@ dns_duckdns_add() { |
|
|
txtvalue=$2 |
|
|
txtvalue=$2 |
|
|
|
|
|
|
|
|
# We'll extract the domain/username from full domain |
|
|
# We'll extract the domain/username from full domain |
|
|
IFS='.' read -r -a fqdn <<< "$fulldomain" |
|
|
|
|
|
DuckDNS_domain="${fqdn[-3]}" |
|
|
|
|
|
|
|
|
DuckDNS_domain=$(printf "%s\n" "$fulldomain" | rev | cut -d \. -f 3 | rev) |
|
|
|
|
|
|
|
|
if [ -z "$DuckDNS_domain" ]; then |
|
|
if [ -z "$DuckDNS_domain" ]; then |
|
|
_err "Error extracting the domain." |
|
|
_err "Error extracting the domain." |
|
@ -42,7 +41,7 @@ dns_duckdns_add() { |
|
|
|
|
|
|
|
|
# Now add the TXT record to DuckDNS |
|
|
# Now add the TXT record to DuckDNS |
|
|
_info "Trying to add TXT record" |
|
|
_info "Trying to add TXT record" |
|
|
if _duckdns_rest GET "$API_Params&txt=$txtvalue" && [ $response == "OK" ]; then |
|
|
|
|
|
|
|
|
if _duckdns_rest GET "$API_Params&txt=$txtvalue" && [ "$response" -eq "OK" ]; then |
|
|
_info "TXT record has been successfully added to your DuckDNS domain." |
|
|
_info "TXT record has been successfully added to your DuckDNS domain." |
|
|
_info "Note that all subdomains under this domain uses the same TXT record." |
|
|
_info "Note that all subdomains under this domain uses the same TXT record." |
|
|
return 0 |
|
|
return 0 |
|
@ -60,7 +59,7 @@ dns_duckdns_rm() { |
|
|
|
|
|
|
|
|
# Now remove the TXT record from DuckDNS |
|
|
# Now remove the TXT record from DuckDNS |
|
|
_info "Trying to remove TXT record" |
|
|
_info "Trying to remove TXT record" |
|
|
if _duckdns_rest GET "$API_Params&txt=&clear=true" && [ $response == "OK" ]; then |
|
|
|
|
|
|
|
|
if _duckdns_rest GET "$API_Params&txt=&clear=true" && [ "$response" -eq "OK" ]; then |
|
|
_info "TXT record has been successfully removed from your DuckDNS domain." |
|
|
_info "TXT record has been successfully removed from your DuckDNS domain." |
|
|
return 0 |
|
|
return 0 |
|
|
else |
|
|
else |
|
@ -80,7 +79,7 @@ _duckdns_rest() { |
|
|
_debug url "$url" |
|
|
_debug url "$url" |
|
|
|
|
|
|
|
|
# DuckDNS uses GET to update domain info |
|
|
# DuckDNS uses GET to update domain info |
|
|
if [ $method == "GET" ]; then |
|
|
|
|
|
|
|
|
if [ "$method" -eq "GET" ]; then |
|
|
response="$(_get "$url")" |
|
|
response="$(_get "$url")" |
|
|
else |
|
|
else |
|
|
_err "Unsupported method" |
|
|
_err "Unsupported method" |
|
|