From 2ba389a2beeb8684f633684d606da6f653fa1205 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 17 May 2021 15:54:54 +0200 Subject: dhcp-to-dns: put string into variable --- dhcp-to-dns | 9 +++++---- 1 file 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 ]; -- cgit v1.2.3-54-g00ecf