From dca1822c00fafeb12caca7e07cb1ff1e2a7bbae1 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Sun, 26 Oct 2025 20:27:58 +0100 Subject: [PATCH] [type/__start_on_boot] Speed up state explorer on OpenBSD Instead of running `rcctl ls on` and grep(1)ing for the service of interest, we can just query the service's status. `rcctl ls on` does the same thing, but it queries the status for all services which is unnecessary for this case. Further, the grep(1) (which interpreted the service name as a regular expression) is not necessary anymore. Another issue with the grep was that it printed the service name if it matched, breaking `$state_is` in `manifest` and `gencode-remote`. --- type/__start_on_boot/explorer/state | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/type/__start_on_boot/explorer/state b/type/__start_on_boot/explorer/state index e13ef1a0b..28f703147 100755 --- a/type/__start_on_boot/explorer/state +++ b/type/__start_on_boot/explorer/state @@ -155,13 +155,17 @@ else esac ;; (openbsd) - state='absent' # OpenBSD 5.7 and higher - rcctl ls on | grep "^${name}$" && state='present' + if rcctl get "${name}" status >/dev/null + then + state='present' + else + state='absent' + fi ;; (*) - printf 'Unsupported os: %s\n' "${os}" >&2 + printf 'Unsupported OS: %s\n' "${os}" >&2 exit 1 ;; esac