Skip to content

Commit dca1822

Browse files
committed
[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`.
1 parent f169e8c commit dca1822

File tree

1 file changed

+7
-3
lines changed
  • type/__start_on_boot/explorer

1 file changed

+7
-3
lines changed

type/__start_on_boot/explorer/state

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,17 @@ else
155155
esac
156156
;;
157157
(openbsd)
158-
state='absent'
159158
# OpenBSD 5.7 and higher
160-
rcctl ls on | grep "^${name}$" && state='present'
159+
if rcctl get "${name}" status >/dev/null
160+
then
161+
state='present'
162+
else
163+
state='absent'
164+
fi
161165
;;
162166
163167
(*)
164-
printf 'Unsupported os: %s\n' "${os}" >&2
168+
printf 'Unsupported OS: %s\n' "${os}" >&2
165169
exit 1
166170
;;
167171
esac

0 commit comments

Comments
 (0)