commit 22a4fd1d395905950fdd307b41b8b8ab4167e130 parent 2fcee6b97111059f771f3e7e90ce93cae424f00d Author: Hayden Hamilton <hayden@hhvn.uk> Date: Mon, 25 May 2026 16:48:26 +0100 Create quick way to edit dns zone(s) Diffstat:
| A | dns/zone/edit | | | 25 | +++++++++++++++++++++++++ |
| A | dns/zone/reload | | | 6 | ++++++ |
2 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/dns/zone/edit b/dns/zone/edit @@ -0,0 +1,25 @@ +#!/bin/rc + +zone = $1 + +fn die { + echo $* >[1=2] + exit 1 +} + +fn try { + test -f $1 && doas $EDITOR $1 && exec dns/zone/reload $zone $1 +} + +if (! test $#* -lt 2) { + die 'usage: dns/edit <zone>' +} + +if (~ $zone ()) { + zone = `hostname +} + +try /var/nsd/zones/master/$zone +try /var/nsd/zones/master/$zone.zone + +die could not guess zone file diff --git a/dns/zone/reload b/dns/zone/reload @@ -0,0 +1,6 @@ +#!/bin/rc + +zone = $1 +zonefile = $2 + +doas nsd-checkzone $zone $zonefile && doas nsd-control reload $zone