add nsd package

This commit is contained in:
nemunaire 2019-03-29 10:52:29 +01:00 committed by Pierre-Olivier Mercier
commit 5a026a9a1f
2 changed files with 31 additions and 2 deletions

28
pkg/nsd/init Executable file
View file

@ -0,0 +1,28 @@
#!/sbin/openrc-run
description="NSD is an authoritative-only, high performance, open source name server"
checkconf=/usr/sbin/nsd-checkconf
cfgfile=${NSD_CONFIG:-/etc/nsd/nsd.conf}
pidfile=$($checkconf -o pidfile $cfgfile)
pidfile=${pidfile:-/var/run/nsd/nsd.pid}
command=/usr/sbin/nsd
command_args=""
depend() {
use logger
}
start_pre() {
[ -f /etc/nsd/nsd.conf ] || {
cp -r /etc/nsd.sample/* /etc/nsd/
nsd-control-setup
}
ebegin
checkpath --directory --owner nsd:nsd ${pidfile%/*}
checkpath --directory --owner nsd:nsd /var/db/nsd/
$checkconf $cfgfile
[ "$cfgfile" = "/etc/nsd/nsd.conf" ] || command_args="$command_args -c $cfgfile"
[ "$pidfile" = "/var/run/nsd/nsd.pid" ] || command_args="$command_args -P $pidfile"
eend $?
}