Check-in [bc20f9df9f]
Logged in as anonymous
Overview
Comment:add default empty start target when it's absent, add flags to control background/foreground mode
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bc20f9df9f2e157747310eb9bc38bb3fae140396cc8a43522d8d5e9460cab848
User & Date: arcade on 2019-10-24 10:31:23.364
Other Links: manifest | tags
Context
2019-10-25
10:49
80 columns, error handling, microcode check-in: 8f8bbe5cbb user: arcade tags: trunk
2019-10-24
10:31
add default empty start target when it's absent, add flags to control background/foreground mode check-in: bc20f9df9f user: arcade tags: trunk
10:30
silence cleanvar error check-in: 527b45759d user: arcade tags: trunk
Changes
Modified Makefile from [a202ff1787] to [bb5a29dbec].
43
44
45
46
47
48
49



50
51
52
53
54
55
56
	echo Empty target.

TARGETS:=${SCRIPTS:S/.init.mk//:S/.service.mk//}

.for file in ${SCRIPTS}
#.info ${file}
.include "${file}"



.endfor

.include "init.mk"

.MAIN: ${TARGETS}

.PHONY: ${TARGETS} ${OTHER_TARGETS}







>
>
>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
	echo Empty target.

TARGETS:=${SCRIPTS:S/.init.mk//:S/.service.mk//}

.for file in ${SCRIPTS}
#.info ${file}
.include "${file}"
.if !target(${file:S/.service.mk//})
${file:S/.service.mk//}: _service
.endif
.endfor

.include "init.mk"

.MAIN: ${TARGETS}

.PHONY: ${TARGETS} ${OTHER_TARGETS}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
LOCAL_TARGETS:=_service_daemon _earlyservice_daemon
OTHER_TARGETS+=${LOCAL_TARGETS}
.if ${STARTER} == "daemon"
LOCAL_TARGETS+=_service _earlyservice
.endif

.for target in ${LOCAL_TARGETS}
${target}: ${target:C/_service.*/DAEMON/:C/_earlyservice.*/SERVICE/} .USE
	test -z "$${DAEMON_$@_ENABLE}" || { \
	  echo "MRC:$@> Starting service."; \
	  test -n "${DAEMON_$@_MODULES}" && kldload -n ${DAEMON_$@_MODULES} || true; \
	  daemon -c -u ${DAEMON_$@_USER:Uroot} -r -P /var/run/daemon.$@.pid ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS}; \
	}
.endfor

.undef LOCAL_TARGETS











|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
LOCAL_TARGETS:=_service_daemon _earlyservice_daemon
OTHER_TARGETS+=${LOCAL_TARGETS}
.if ${STARTER} == "daemon"
LOCAL_TARGETS+=_service _earlyservice
.endif

.for target in ${LOCAL_TARGETS}
${target}: ${target:C/_service.*/DAEMON/:C/_earlyservice.*/SERVICE/} .USE
	test -z "$${DAEMON_$@_ENABLE}" || { \
	  echo "MRC:$@> Starting service."; \
	  test -n "${DAEMON_$@_MODULES}" && kldload -n ${DAEMON_$@_MODULES} || true; \
	  daemon -c -u ${DAEMON_$@_USER:Uroot} -r -P /var/run/daemon.$@.pid ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON$@_FOREGROUND}; \
	}
.endfor

.undef LOCAL_TARGETS
1
2
3


4
5
6
7
8
9
DAEMON_dbus_COMMAND?=/usr/local/bin/dbus-daemon
DAEMON_dbus_ENABLE?=no
DAEMON_dbus_FLAGS?=--system



dbus: _service
	test -z "$${DAEMON_$@_ENABLE}" || { \
	  /usr/local/bin/dbus-uuidgen --ensure; \
	  mkdir -p /var/run/dbus; \
	}



>
>






1
2
3
4
5
6
7
8
9
10
11
DAEMON_dbus_COMMAND?=/usr/local/bin/dbus-daemon
DAEMON_dbus_ENABLE?=no
DAEMON_dbus_FLAGS?=--system
DAEMON_dbus_BACKGROUND?=--fork
DAEMON_dbus_FOREGROUND?=--nofork

dbus: _service
	test -z "$${DAEMON_$@_ENABLE}" || { \
	  /usr/local/bin/dbus-uuidgen --ensure; \
	  mkdir -p /var/run/dbus; \
	}
1
2
3
4
5
6
DAEMON_devd_COMMAND?=/sbin/devd
DAEMON_devd_ENABLE?=yes
DAEMON_devd_FLAGS?=-dq

devd: _earlyservice
	test -n "$${DAEMON_$@_ENABLE}" || sysctl hw.bus.devctl_disable=1


|



1
2
3
4
5
6
DAEMON_devd_COMMAND?=/sbin/devd
DAEMON_devd_ENABLE?=yes
DAEMON_devd_FOREGROUND?=-dq

devd: _earlyservice
	test -n "$${DAEMON_$@_ENABLE}" || sysctl hw.bus.devctl_disable=1
1
2

3
4
5
DAEMON_dhcpcd_COMMAND?=/sbin/dhcpcd
DAEMON_dhcpcd_ENABLE?=no

DAEMON_dhcpcd_FLAGS?=-B

dhcpcd: _service NETWORK SERVICE # mount -> SERVICE, cleanvar -> SERVICE


>
|


1
2
3
4
5
6
DAEMON_dhcpcd_COMMAND?=/sbin/dhcpcd
DAEMON_dhcpcd_ENABLE?=no
DAEMON_dhcpcd_BACKGROUND?=-b
DAEMON_dhcpcd_FOREGROUND?=-B

dhcpcd: _service NETWORK SERVICE # mount -> SERVICE, cleanvar -> SERVICE
1
2
3
4
DAEMON_dntpd_COMMAND?=/usr/sbin/dntpd
DAEMON_dntpd_FLAGS?=-F

dntpd: _service NETWORK

|


1
2
3
4
DAEMON_dntpd_COMMAND?=/usr/sbin/dntpd
DAEMON_dntpd_FOREGROUND?=-F

dntpd: _service NETWORK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
LOCAL_TARGETS:=_service_plain _earlyservice_plain
OTHER_TARGETS+=${LOCAL_TARGETS}
.if ${STARTER} == "plain"
LOCAL_TARGETS+=_service _earlyservice
.endif

.for target in ${LOCAL_TARGETS}
${target}: ${target:C/_service.*/DAEMON/:C/_earlyservice.*/SERVICE/} .USE
	test -z "$${DAEMON_$@_ENABLE}" || { \
	  echo "MRC:$@> Starting service."; \
	  test -n "${DAEMON_$@_MODULES}" && kldload -n ${DAEMON_$@_MODULES} || true; \
	  chroot -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} / ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS}; \
	}
.endfor

.undef LOCAL_TARGETS











|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
LOCAL_TARGETS:=_service_plain _earlyservice_plain
OTHER_TARGETS+=${LOCAL_TARGETS}
.if ${STARTER} == "plain"
LOCAL_TARGETS+=_service _earlyservice
.endif

.for target in ${LOCAL_TARGETS}
${target}: ${target:C/_service.*/DAEMON/:C/_earlyservice.*/SERVICE/} .USE
	test -z "$${DAEMON_$@_ENABLE}" || { \
	  echo "MRC:$@> Starting service."; \
	  test -n "${DAEMON_$@_MODULES}" && kldload -n ${DAEMON_$@_MODULES} || true; \
	  chroot -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} / ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON_$@_BACKGROUND}; \
	}
.endfor

.undef LOCAL_TARGETS
1
2

3
4
5
DAEMON_slim_COMMAND?=/usr/local/bin/slim
DAEMON_slim_ENABLE?=no


slim: _service dbus
	rm -f /var/run/slim.auth


>



1
2
3
4
5
6
DAEMON_slim_COMMAND?=/usr/local/bin/slim
DAEMON_slim_ENABLE?=no
DAEMON_slim_BACKGROUND?=-d

slim: _service dbus
	rm -f /var/run/slim.auth
1
2
3

4
5
6
7
8
9
10
DAEMON_smartd_COMMAND?=/usr/local/sbin/smartd
DAEMON_smartd_ENABLE?=no
DAEMON_smartd_FLAGS?=-c /usr/local/etc/smartd.conf -n


smartd: _service
	test -z "$${DAEMON_$@_ENABLE}" || \
	test -f /usr/local/etc/smartd.conf || { \
	  echo "MRC:$@> smartd requires config file to start." ; \
	  false; \
	}


|
>







1
2
3
4
5
6
7
8
9
10
11
DAEMON_smartd_COMMAND?=/usr/local/sbin/smartd
DAEMON_smartd_ENABLE?=no
DAEMON_smartd_FLAGS?=-c /usr/local/etc/smartd.conf
DAEMON_smartd_FOREGROUND?=-n

smartd: _service
	test -z "$${DAEMON_$@_ENABLE}" || \
	test -f /usr/local/etc/smartd.conf || { \
	  echo "MRC:$@> smartd requires config file to start." ; \
	  false; \
	}
1
2
3
4
5
DAEMON_sndiod_COMMAND?=/usr/local/bin/sndiod
DAEMON_sndiod_ENABLE?=no
DAEMON_sndiod_FLAGS?=-c 0:7 -j off -s default -m mon -s monitor -d

sndiod: _service


|
<
<
1
2
3


DAEMON_sndiod_COMMAND?=/usr/local/bin/sndiod
DAEMON_sndiod_ENABLE?=no
DAEMON_sndiod_FLAGS?=-c 0:7 -j off -s default -m mon -s monitor


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
LOCAL_TARGETS:=_service_svc _earlyservice_svc
OTHER_TARGETS+=_service_svc _earlyservice_svc
.if ${STARTER} == "svc"
LOCAL_TARGETS+=_service _earlyservice
.endif

.for target in ${LOCAL_TARGETS}
${target}: ${target:C/_service.*/DAEMON/:C/_earlyservice/SERVICE/} .USE
	test -z "$${DAEMON_$@_ENABLE}" || { \
	  echo "MRC:$@> Starting service."; \
	  test -n "${DAEMON_$@_MODULES}" && kldload -n ${DAEMON_$@_MODULES} || true; \
	  svc -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} init $@ ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS}; \
	}
.endfor

.undef LOCAL_TARGETS











|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
LOCAL_TARGETS:=_service_svc _earlyservice_svc
OTHER_TARGETS+=_service_svc _earlyservice_svc
.if ${STARTER} == "svc"
LOCAL_TARGETS+=_service _earlyservice
.endif

.for target in ${LOCAL_TARGETS}
${target}: ${target:C/_service.*/DAEMON/:C/_earlyservice/SERVICE/} .USE
	test -z "$${DAEMON_$@_ENABLE}" || { \
	  echo "MRC:$@> Starting service."; \
	  test -n "${DAEMON_$@_MODULES}" && kldload -n ${DAEMON_$@_MODULES} || true; \
	  svc -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} init $@ ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON_$@_FOREGROUND}; \
	}
.endfor

.undef LOCAL_TARGETS
1
2
3
4
5
6
7
8
9
DAEMON_watchdogd_COMMAND?=/usr/sbin/watchdogd
DAEMON_watchdogd_ENABLE?=no
DAEMON_watchdogd_FLAGS?=-d

.if empty(:!sysctl -qn debug.watchdog || exit 0!)
DAEMON_watchdogd_ENABLE=no
.endif

watchdogd: _earlyservice


|






1
2
3
4
5
6
7
8
9
DAEMON_watchdogd_COMMAND?=/usr/sbin/watchdogd
DAEMON_watchdogd_ENABLE?=no
DAEMON_watchdogd_FOREGROUND?=-d

.if empty(:!sysctl -qn debug.watchdog || exit 0!)
DAEMON_watchdogd_ENABLE=no
.endif

watchdogd: _earlyservice