Date: Mon, 8 Sep 2014 09:33:43 +0000 (UTC) From: Dag-Erling Smørgrav <des@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271257 - in head/etc: defaults rc.d Message-ID: <201409080933.s889XhXr059263@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: des Date: Mon Sep 8 09:33:43 2014 New Revision: 271257 URL: http://svnweb.freebsd.org/changeset/base/271257 Log: Use the correct idiom for default values, and ensure that the script works correctly if the user overrides them. PR: 193255 Submitted by: hrs@ MFC after: 3 days Modified: head/etc/defaults/rc.conf head/etc/rc.d/local_unbound Modified: head/etc/defaults/rc.conf ============================================================================== --- head/etc/defaults/rc.conf Mon Sep 8 09:19:01 2014 (r271256) +++ head/etc/defaults/rc.conf Mon Sep 8 09:33:43 2014 (r271257) @@ -267,6 +267,13 @@ hastd_program="/sbin/hastd" # path to ha hastd_flags="" # Optional flags to hastd. ctld_enable="NO" # CAM Target Layer / iSCSI target daemon. local_unbound_enable="NO" # local caching resolver +local_unbound_program="/usr/sbin/unbound" +local_unbound_workdir=/var/unbound +local_unbound_config="${local_unbound_workdir}/unbound.conf" +local_unbound_flags="-c${local_unbound_config}" +local_unbound_forwardconf="${local_unbound_workdir}/forward.conf}" +local_unbound_anchor="${local_unbound_workdir}/root.key" +local_unbound_forwarders="" # # kerberos. Do not run the admin daemons on slave servers Modified: head/etc/rc.d/local_unbound ============================================================================== --- head/etc/rc.d/local_unbound Mon Sep 8 09:19:01 2014 (r271256) +++ head/etc/rc.d/local_unbound Mon Sep 8 09:33:43 2014 (r271257) @@ -13,7 +13,6 @@ name="local_unbound" desc="local caching forwarding resolver" rcvar="local_unbound_enable" -command="/usr/sbin/unbound" extra_commands="anchor configtest reload setup" start_precmd="local_unbound_prestart" reload_precmd="local_unbound_configtest" @@ -22,18 +21,9 @@ configtest_cmd="local_unbound_configtest setup_cmd="local_unbound_setup" pidfile="/var/run/${name}.pid" -: ${local_unbound_workdir:=/var/unbound} -: ${local_unbound_config:=${local_unbound_workdir}/unbound.conf} -: ${local_unbound_flags:=-c${local_unbound_config}} -: ${local_unbound_forwardconf:=${local_unbound_workdir}/forward.conf} -: ${local_unbound_anchor:=${local_unbound_workdir}/root.key} -: ${local_unbound_forwarders:=} - -load_rc_config $name - do_as_unbound() { - echo "$@" | su -m unbound + echo "$@" | /usr/bin/su -m unbound } # @@ -41,7 +31,8 @@ do_as_unbound() # local_unbound_anchor() { - do_as_unbound /usr/sbin/unbound-anchor -a ${local_unbound_anchor} + do_as_unbound ${local_unbound_program%/*}/unbound-anchor \ + -a ${local_unbound_anchor} # we can't trust the exit code - check if the file exists [ -f ${local_unbound_anchor} ] } @@ -51,7 +42,8 @@ local_unbound_anchor() # local_unbound_configtest() { - do_as_unbound /usr/sbin/unbound-checkconf ${local_unbound_config} + do_as_unbound ${local_unbound_program%/*}/unbound-checkconf \ + ${local_unbound_config} } # @@ -61,7 +53,7 @@ local_unbound_configtest() local_unbound_setup() { echo "Performing initial setup." - /usr/sbin/local-unbound-setup -n \ + ${local_unbound_program%/*}/local-unbound-setup -n \ -u unbound \ -w ${local_unbound_workdir} \ -c ${local_unbound_config} \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409080933.s889XhXr059263>