>> +    while getopts :l: _opt $daemon_flags; do
>> +            [[ $_opt == l ]] && pflog=$OPTARG
>> +    done
>
> You are the experts but (to me) this looks like assumptions are still
> being made about the formatting of what's in daemon_flags.

Oops, my bad.  That is much better than what I did!  (I misread it)

So for etc/rc.d/unbound I propose:

--- 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=
+
+       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

Reply via email to