diff options
author | 2013-11-26 13:01:30 +0000 | |
---|---|---|
committer | 2013-11-26 13:01:30 +0000 | |
commit | 19249f9a085b898faecb9b7fcc565b2c8a1b10ec (patch) | |
tree | 567ccf02f231257975e376146cd84eb31d88157f | |
parent | new sample config entries for NSD 4.0.0 (diff) | |
download | wireguard-openbsd-19249f9a085b898faecb9b7fcc565b2c8a1b10ec.tar.xz wireguard-openbsd-19249f9a085b898faecb9b7fcc565b2c8a1b10ec.zip |
update for NSD 4.0.0; generate keys for nsd-control if non-existent, and
use nsd-control to signal NSD.
-rw-r--r-- | etc/rc.d/nsd | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/etc/rc.d/nsd b/etc/rc.d/nsd index 72dd1267fb8..c426ad0d100 100644 --- a/etc/rc.d/nsd +++ b/etc/rc.d/nsd @@ -1,22 +1,43 @@ #!/bin/sh # -# $OpenBSD: nsd,v 1.4 2012/08/04 15:28:39 ajacoutot Exp $ +# $OpenBSD: nsd,v 1.5 2013/11/26 13:01:30 sthen Exp $ -daemon="/usr/sbin/nsd" +daemon="/usr/sbin/nsd-control" +daemon_flags="-c /var/nsd/etc/nsd.conf" . /etc/rc.d/rc.subr -rc_reload=NO +pexp="nsd${daemon_flags:+ ${daemon_flags}}" rc_usercheck=NO -daemon_ctl="/usr/sbin/nsdc" +rc_pre() { + if ! [[ -f /var/nsd/etc/nsd_server.key || + -f /var/nsd/etc/nsd_server.pem || + -f /var/nsd/etc/nsd_control.key || + -f /var/nsd/etc/nsd_control.pem ]]; then + /usr/sbin/nsd-control-setup >/dev/null 2>&1 + fi +} -rc_stop() { - ${daemon_ctl} stop +rc_start() { + ${rcexec} "${daemon} ${daemon_flags} start" } rc_check() { - ${daemon_ctl} running + ${daemon} status +} + +rc_reload() { + ${daemon} reconfig && ${daemon} reload +} + +rc_stop() { + ${daemon} stop +} + +rc_post() { + sleep 1 + rc_do rc_check || exit 0 } rc_cmd $1 |