ebafd89015 2019-10-21 1: LOCAL_TARGETS:=_service_svc _earlyservice_svc
e71c4b0c63 2020-05-26 2: STATUS_TARGETS:=_status_svc
e71c4b0c63 2020-05-26 3: RESTART_TARGETS:=_restart_svc
e71c4b0c63 2020-05-26 4: OTHER_TARGETS+=${LOCAL_TARGETS} ${STATUS_TARGETS} ${RESTART_TARGETS}
ebafd89015 2019-10-21 5: .if ${STARTER} == "svc"
ebafd89015 2019-10-21 6: LOCAL_TARGETS+=_service _earlyservice
e71c4b0c63 2020-05-26 7: STATUS_TARGETS+=_status
e71c4b0c63 2020-05-26 8: RESTART_TARGETS+=_restart
ebafd89015 2019-10-21 9: .endif
ebafd89015 2019-10-21 10:
ebafd89015 2019-10-21 11: .for target in ${LOCAL_TARGETS}
ebafd89015 2019-10-21 12: ${target}: ${target:C/_service.*/DAEMON/:C/_earlyservice/SERVICE/} .USE
ebafd89015 2019-10-21 13: test -z "$${DAEMON_$@_ENABLE}" || { \
7a1e7f4a58 2019-10-21 14: echo "MRC:$@> Starting service."; \
ebafd89015 2019-10-21 15: test -n "${DAEMON_$@_MODULES}" && kldload -n ${DAEMON_$@_MODULES} || true; \
e71c4b0c63 2020-05-26 16: svc -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} ${DAEMON_$@_RESTART:D-r} ${DAEMON_$@_RESTART} init $@ ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON_$@_FOREGROUND}; \
ebafd89015 2019-10-21 17: }
ebafd89015 2019-10-21 18: .endfor
ebafd89015 2019-10-21 19:
e71c4b0c63 2020-05-26 20: .for target in ${RESTART_TARGETS}
e71c4b0c63 2020-05-26 21: ${target}: .USE
e71c4b0c63 2020-05-26 22: svc restart $@
e71c4b0c63 2020-05-26 23: .endfor
e71c4b0c63 2020-05-26 24:
e71c4b0c63 2020-05-26 25: .for target in ${STATUS_TARGETS}
e71c4b0c63 2020-05-26 26: ${target}: .USE
e71c4b0c63 2020-05-26 27: svc status $@
e71c4b0c63 2020-05-26 28: .endfor
e71c4b0c63 2020-05-26 29:
ebafd89015 2019-10-21 30: .undef LOCAL_TARGETS
e71c4b0c63 2020-05-26 31: .undef RESTART_TARGETS
e71c4b0c63 2020-05-26 32: .undef STATUS_TARGETS