diff options
author | Christian Hesse <mail@eworm.de> | 2019-02-08 12:59:22 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2019-02-08 13:02:39 +0100 |
commit | 0a34f4c2c218734a6b4f82e2718538138becf21c (patch) | |
tree | 1103130a28e82de4618e871ce2b229c9e63f5298 /dhcp-to-dns | |
parent | fc2547c13764de7ea485da12f4bf2a3610bd7a28 (diff) |
dhcp-to-dns: use $CharacterReplace
Diffstat (limited to 'dhcp-to-dns')
-rw-r--r-- | dhcp-to-dns | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/dhcp-to-dns b/dhcp-to-dns index 3ee7155..d769bf6 100644 --- a/dhcp-to-dns +++ b/dhcp-to-dns @@ -4,6 +4,8 @@ # # check DHCP leases and add/remove/update DNS entries +:global CharacterReplace; + :global Identity; :global Domain; :global HostNameInZone; @@ -39,12 +41,7 @@ :local Mac [ / ip dhcp-server lease get $Lease mac-address ]; :set DhcpIp [ / ip dhcp-server lease get $Lease address ]; :local Comment ("managed by dhcp-to-dns for " . $Mac); - :set HostName [ / ip dhcp-server lease get $Lease host-name ]; - - :while ($HostName ~ " ") do={ - :local Pos [ :find $HostName " " ]; - :set HostName ([ :pick $HostName 0 $Pos ] . [ :pick $HostName ($Pos + 1) 999 ]); - }; + :set HostName [ $CharacterReplace [ / ip dhcp-server lease get $Lease host-name ] " " "" ]; :if ([ :len $HostName ] > 0) do={ :set Fqdn ($HostName . "." . $Zone); |