Merge pull request #20201 from LecrisUT/ddns-scripts/pdns
ddns-scripts: Allow setting root record for pdns script
This commit is contained in:
commit
7f39559474
2 changed files with 13 additions and 2 deletions
|
@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=ddns-scripts
|
PKG_NAME:=ddns-scripts
|
||||||
PKG_VERSION:=2.8.2
|
PKG_VERSION:=2.8.2
|
||||||
PKG_RELEASE:=30
|
PKG_RELEASE:=31
|
||||||
|
|
||||||
PKG_LICENSE:=GPL-2.0
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
local __TTL=600
|
local __TTL=600
|
||||||
local __RRTYPE
|
local __RRTYPE
|
||||||
local __STATUS
|
local __STATUS
|
||||||
|
local __RNAME
|
||||||
|
|
||||||
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing subdomain as 'username'"
|
[ -z "$username" ] && write_log 14 "Service section not configured correctly! Missing subdomain as 'username'"
|
||||||
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing API Key as 'password'"
|
[ -z "$password" ] && write_log 14 "Service section not configured correctly! Missing API Key as 'password'"
|
||||||
|
@ -16,11 +17,21 @@ local __ENDPOINT="$param_opt/api/v1/servers/localhost/zones"
|
||||||
|
|
||||||
[ $use_ipv6 -ne 0 ] && __RRTYPE="AAAA" || __RRTYPE="A"
|
[ $use_ipv6 -ne 0 ] && __RRTYPE="AAAA" || __RRTYPE="A"
|
||||||
|
|
||||||
|
# Make sure domain is period terminated
|
||||||
|
if [ ${domain: -1} != '.' ]; then
|
||||||
|
domain="${domain}."
|
||||||
|
fi
|
||||||
|
if [ $username == '@' ]; then
|
||||||
|
__RNAME="$domain"
|
||||||
|
else
|
||||||
|
__RNAME="$username.$domain"
|
||||||
|
fi
|
||||||
|
|
||||||
# Build JSON payload
|
# Build JSON payload
|
||||||
json_init
|
json_init
|
||||||
json_add_array rrsets
|
json_add_array rrsets
|
||||||
json_add_object
|
json_add_object
|
||||||
json_add_string name "$username.$domain"
|
json_add_string name "$__RNAME"
|
||||||
json_add_string type "$__RRTYPE"
|
json_add_string type "$__RRTYPE"
|
||||||
json_add_int ttl $__TTL
|
json_add_int ttl $__TTL
|
||||||
json_add_string changetype "REPLACE"
|
json_add_string changetype "REPLACE"
|
||||||
|
|
Loading…
Reference in a new issue