#!/bin/sh # # $FreeBSD: head/dns/unbound/files/unbound.in 354104 2014-05-15 08:27:53Z sem $ # # unbound freebsd startup rc.d script, modified from the named script. # uses the default unbound installation path and pidfile location. # copy this to /etc/rc.d/unbound # and put unbound_enable="YES" into rc.conf # # unbound_anchorflags can be used to allow you to pass a custom flags to # unbound-anchor. Examples include a custom resolv.conf (-f) or a custom # root.hints (-r). Useful for when /etc/resolv.conf only contains 127.0.0.1 # PROVIDE: unbound # REQUIRE: SERVERS cleanvar # KEYWORD: shutdown . /etc/rc.subr name="unbound" rcvar=unbound_enable command="%%PREFIX%%/sbin/unbound" extra_commands="reload" start_precmd="start_precmd" reload_precmd="%%PREFIX%%/sbin/unbound-checkconf >/dev/null" load_rc_config $name pidfile=${unbound_pidfile:-"%%PREFIX%%/etc/unbound/unbound.pid"} unbound_enable=${unbound_enable:-"NO"} unbound_anchorflags=${unbound_anchorflags:-""} start_precmd() { %%PREFIX%%/sbin/unbound-checkconf > /dev/null && \ echo -n "Obtaining a trust anchor:" && \ if [ "${unbound_anchorflags}T" = "T" ]; then \ su -m unbound -c %%PREFIX%%/sbin/unbound-anchor; \ else su -m unbound -c "%%PREFIX%%/sbin/unbound-anchor ${unbound_anchorflags}"; \ fi && echo . return 0 } run_rc_command "$1"