diff options
| author | Cristian Le <git@lecris.me> | 2022-12-31 22:21:42 +0100 |
|---|---|---|
| committer | Cristian Le <git@lecris.me> | 2022-12-31 22:21:42 +0100 |
| commit | ff099ea53cdbf236c2471a4f51501bc33b1627be (patch) | |
| tree | 98c056c73a31f093b75dbe7dea4c8bef551673bf | |
| parent | ac13ebc68f20c0ca6e3ccf553e67e32bc7d9c933 (diff) | |
ddns-scripts: Allow setting root record for pdns script
Signed-off-by: Cristian Le <git@lecris.me>
| -rw-r--r-- | net/ddns-scripts/Makefile | 2 | ||||
| -rwxr-xr-x | net/ddns-scripts/files/usr/lib/ddns/update_pdns.sh | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile index 9e6e57ba7..8021a4f4e 100644 --- a/net/ddns-scripts/Makefile +++ b/net/ddns-scripts/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ddns-scripts PKG_VERSION:=2.8.2 -PKG_RELEASE:=30 +PKG_RELEASE:=31 PKG_LICENSE:=GPL-2.0 diff --git a/net/ddns-scripts/files/usr/lib/ddns/update_pdns.sh b/net/ddns-scripts/files/usr/lib/ddns/update_pdns.sh index d3fc2d2c9..a19ed13f1 100755 --- a/net/ddns-scripts/files/usr/lib/ddns/update_pdns.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/update_pdns.sh @@ -5,6 +5,7 @@ local __TTL=600 local __RRTYPE local __STATUS +local __RNAME [ -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'" @@ -16,11 +17,21 @@ local __ENDPOINT="$param_opt/api/v1/servers/localhost/zones" [ $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 json_init json_add_array rrsets json_add_object - json_add_string name "$username.$domain" + json_add_string name "$__RNAME" json_add_string type "$__RRTYPE" json_add_int ttl $__TTL json_add_string changetype "REPLACE" |
