Lines of
starter.mk
from check-in adf4eb9997
that are changed by the sequence of edits moving toward
check-in 5066f4e4fd:
1: OTHER_TARGETS+=_service_pre
2:
3: STARTER?=svc
4:
5: _service_check: .USEBEFORE
6: # check whether service is enabled
7: if [ -z "$${DAEMON_$@_ENABLE}" -a -z "${FORCE}" ]; then \
8: exit 0 ;\
9: fi
10: # check for first present executable
adf4eb9997 2023-11-04 11: for COMMAND in ${DAEMON_$@_COMMAND}; do \
adf4eb9997 2023-11-04 12: if [ -x $${COMMAND} ]; then \
adf4eb9997 2023-11-04 13: export CMD="${COMMAND}" ;\
14: break ;\
15: fi ;\
16: done
17: # bail out if binary not found
18: if [ -z $${CMD} ]; then \
adf4eb9997 2023-11-04 19: MRC:$@> Executable not found.
20: exit 0 ;\
21: fi
22: # check for rtprio/idprio
23: if [ -n "$${DAEMON_$@_IDPRIO}" ]; then \
24: export CMD="/usr/sbin/idprio $${DAEMON_$@_IDPRIO} $${CMD}" ;\
25: elif [ -n "$${DAEMON_$@_RTPRIO}" ]; then \
26: export CMD="/usr/sbin/rtprio $${DAEMON_$@_RTPRIO} $${CMD}" ;\
27: fi
28:
29: _service_pre: .USEBEFORE
30: # kldload modules if any
31: echo "MRC:$@> Starting service." ;\
32: if [ -n "${DAEMON_$@_MODULES}" ]; then \
33: kldload -n ${DAEMON_$@_MODULES}; \
34: fi
35:
36: _service_post_exit: .USE
37: echo "MRC:${@:S/_exit//}> stopped."
38:
39: .for starter_source in ${:!find /etc/mrc -name '*.starter.mk'!:S/\/etc\/mrc\///}
40: starter:=${starter_source:S/.starter.mk$//}
41: Starter:=${starter:tu}
42:
43: OTHER_TARGETS:=${OTHER_TARGETS} _service_${starter} _service_${starter}_exit _service_${starter}_status
44:
45: _SERVICE_${Starter}:=_service_pre DAEMON _service_${starter} _service_check
46: _EARLYSERVICE_${Starter}:=_service_pre SERVICE _service_${starter} _service_check
47: _SERVICE_${Starter}_EXIT:=_service_${starter}_exit _service_post_exit
48:
49: .if "${STARTER}" == "${starter}"
50: _SERVICE:=_service_pre DAEMON _service_${starter} _service_check
51: _EARLYSERVICE:=_service_pre SERVICE _service_${starter} _service_check
52: _SERVICE_EXIT:=_service_${starter}_exit _service_post_exit
53: .endif
54:
55: .export
56: .include "${starter_source}"
57: .endfor