diff options
author | Christian Hesse <mail@eworm.de> | 2021-05-17 15:54:54 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2021-05-17 16:18:07 +0200 |
commit | 2ba389a2beeb8684f633684d606da6f653fa1205 (patch) | |
tree | cc35622f5657ea8d5d8f9f692ad54fa066bb1f02 | |
parent | ed1a6c5de9a42c93ed271bfde177617effa27f8a (diff) |
dhcp-to-dns: put string into variable
-rw-r--r-- | dhcp-to-dns | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/dhcp-to-dns b/dhcp-to-dns index dfb438f..83e312f 100644 --- a/dhcp-to-dns +++ b/dhcp-to-dns @@ -25,12 +25,13 @@ [ $IfThenElse ($HostNameInZone = true) ($Identity . ".") ] . $Domain); :local Ttl 5m; :local CommentPrefix "managed by dhcp-to-dns for "; +:local CommentString "--- dhcp-to-dns above ---"; -:if ([ :len [ / ip dns static find where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ] ] = 0) do={ - / ip dns static add comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled=yes; - $LogPrintExit2 warning $0 ("Added disabled static dns record with comment '--- dhcp-to-dns above ---'.") false; +:if ([ :len [ / ip dns static find where comment=$CommentString name=- type=NXDOMAIN disabled ] ] = 0) do={ + / ip dns static add comment=$CommentString name=- type=NXDOMAIN disabled=yes; + $LogPrintExit2 warning $0 ("Added disabled static dns record with comment '" . $CommentString . "'.") false; } -:local PlaceBefore ([ / ip dns static find where comment="--- dhcp-to-dns above ---" name=- type=NXDOMAIN disabled ]->0); +:local PlaceBefore ([ / ip dns static find where comment=$CommentString name=- type=NXDOMAIN disabled ]->0); :foreach DnsRecord in=[ / ip dns static find where comment ~ $CommentPrefix ] do={ :local DnsRecordVal [ / ip dns static get $DnsRecord ]; |