I promise to shut up after this post. I can be picky myself.
Since "_opt" is used in the function, shouldn't it be included in the "local"
line.
_conf has an "=" to be sure it's value is blank if not set in the while loop.
(unbound-checkconf does the correct thing if $_conf is blank)
Updated diff:
--- etc/rc.d/unbound Wed Oct 9 11:42:56 2024
+++ etc/rc.d/unbound Fri Nov 14 15:22:49 2025
@@ -1,20 +1,26 @@
#!/bin/ksh
#
# $OpenBSD: unbound,v 1.9 2024/10/09 15:42:56 kn Exp $
daemon="/usr/sbin/unbound"
daemon_flags="-c /var/unbound/etc/unbound.conf"
. /etc/rc.d/rc.subr
rc_pre() {
+ local _conf= _opt
+
+ while getopts :c: _opt $daemon_flags; do
+ [[ $_opt == c ]] && _conf=$OPTARG
+ done
+
- local _anchor=$(/usr/sbin/unbound-checkconf -o auto-trust-anchor-file)
+ local _anchor=$(/usr/sbin/unbound-checkconf -o auto-trust-anchor-file
$_conf)
if [[ -n $_anchor && ! -f $_anchor ]]; then
- /usr/sbin/unbound-anchor -v
+ /usr/sbin/unbound-anchor -v -a $_anchor
fi
- /usr/sbin/unbound-checkconf
+ /usr/sbin/unbound-checkconf $_conf
}
rc_cmd $1