Check-in [d8511a3d7c]
Logged in as anonymous
Overview
Comment:rebuild starters and enable shutdown, add license
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d8511a3d7c09290565e47df76dc7c2865919e3e50190f6240a1e2cabe8b7f327
User & Date: arcade on 2022-05-30 08:07:59.204
Other Links: manifest | tags
Context
2022-05-30
13:17
finalize order, service names, naming, defaults etc. check-in: 04f7295047 user: arcade tags: trunk
08:07
rebuild starters and enable shutdown, add license check-in: d8511a3d7c user: arcade tags: trunk
2022-05-29
11:37
mostly mount fixes check-in: d332ed9f4a user: arcade tags: trunk
Changes
Added LICENSE.0BSD version [970c2ee050].
Modified Makefile from [4b1a082d4f] to [c2a491fdbe].
1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

48
49
50


51
52
53


54
55
56


57
58
59


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
.include "defaults.mk"

.include "/etc/mrc.mk"
.export

OTHER_TARGETS:=_service _earlyservice
STARTER?=svc

.for starter in ${:!find /etc/mrc -name '*.starter.mk'!:S/\/etc\/mrc\///}
.include "${starter}"
.endfor

.if !target(_service) || !target(_earlyservice)
.error No service handler defined.
.endif

.SILENT:

install:
	install rc /etc/rc


SCRIPTS=${:!find /etc/mrc -name '*.service.mk'!:S/\/etc\/mrc\///}
TARGETS:=${SCRIPTS:S/.service.mk//}

.if defined(AUTOBOOT)
.include "init.mk"

.ERROR:
	: ERROR: ABORTING BOOT (sending SIGTERM to parent)!
	: target ${.ERROR_TARGET} failed to execute:
	: ${.ERROR_CMD}
	kill 1
.else
DAEMON: NETWORK SERVERS
LOGIN: DAEMON
NETWORK:
SERVERS:
SERVICE:

mount:
root:
netif:
newsyslog:
.endif

test:
	echo Empty target.


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


.if !target(${file:S/.service.mk//})
${file:S/.service.mk//}: _service
.endif


.if !target(${file:S/.service.mk/_status/})
${file:S/.service.mk/_status/}: _status
.endif


.if !target(${file:S/.service.mk/_restart/})
${file:S/.service.mk/_restart/}: _restart
.endif


.endfor

.MAIN: ${TARGETS}

.PHONY: ${TARGETS} ${OTHER_TARGETS}

.undef TARGETS OTHER_TARGETS SCRIPTS

ENABLED=${:!env!:C/=.*//:M*_ENABLE}

.for var in ${ENABLED}
.if !empty(${var}:tl:Mno)
#.info ${var}
.undef ${var}
.endif
.endfor

.undef ENABLED
.unexport-env
.export
#.info ${:!env!}

>



|
<

<
|
<
<
<
<
<





>

|
<









<
<
<
<
<
<
<
<
<
<
<





>
|
<
|
>
>
|
|
|
>
>
|
|
|
>
>
|
|
|
>
>


|

|
<
|

|


|

|
|






1
2
3
4
5
6

7

8





9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25











26
27
28
29
30
31
32

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
.include "defaults.mk"
.include "order.mk"
.include "/etc/mrc.mk"
.export

OTHER_TARGETS:=



.include "starter.mk"






.SILENT:

install:
	install rc /etc/rc
	install rc.shutdown /etc/rc.shutdown

SCRIPTS:=${:!find /etc/mrc -name '*.service.mk'!:S/^\/etc\/mrc\///:S/.service.mk$//}


.if defined(AUTOBOOT)
.include "init.mk"

.ERROR:
	: ERROR: ABORTING BOOT (sending SIGTERM to parent)!
	: target ${.ERROR_TARGET} failed to execute:
	: ${.ERROR_CMD}
	kill 1











.endif

test:
	echo Empty target.

# Create service targets
.for service in ${SCRIPTS}

.	include "${service}.service.mk"

# Service creation targets
.	if !target(${service})
${service}: ${_SERVICE}
.	endif

# Service creation targets
.	if !target(${service}_status)
${service}_status: ${_SERVICE_STATUS}
.	endif

# Service exit targets
.	if !target(${service}_exit)
${service}_exit: ${_SERVICE_EXIT}
.	endif

DAEMON_EXIT: ${service}_exit
.endfor

.MAIN: ${SCRIPTS} ${TARGETS}

.PHONY: ${SCRIPTS} ${OTHER_TARGETS} ${TARGETS}

.undef OTHER_TARGETS SCRIPTS TARGETS

ENABLED:=${:!env!:C/=.*//:M*_ENABLE}

.for var in ${ENABLED}
.	if !empty(${var}:tl:Mno)
#.info ${var}
.		undef ${var}
.	endif
.endfor

.undef ENABLED
.unexport-env
.export
#.info ${:!env!}
1
2
3
4
5
6


DAEMON_automountd_COMMAND?=/usr/sbin/automountd
DAEMON_automountd_ENABLE?=no
DAEMON_automountd_MODULES=autofs

automountd: _service # nfsclient -> DAEMON
	test -z "$${DAEMON_$@_ENABLE}" || /usr/sbin/automount






|
|
>
>
1
2
3
4
5
6
7
8
DAEMON_automountd_COMMAND?=/usr/sbin/automountd
DAEMON_automountd_ENABLE?=no
DAEMON_automountd_MODULES=autofs

automountd: ${_SERVICE} # nfsclient -> DAEMON
	/usr/sbin/automount

NETWORK_EXIT: automountd_exit
1
2
3
4

5
DAEMON_bsdstats_COMMAND?=/usr/local/etc/periodic/monthly/300.statistics
DAEMON_bsdstats_ENABLE?=no
DAEMON_bsdstats_FLAGS?=-nodelay


bsdstats: _plain_service




>
|
1
2
3
4
5
6
DAEMON_bsdstats_COMMAND?=/usr/local/etc/periodic/monthly/300.statistics
DAEMON_bsdstats_ENABLE?=no
DAEMON_bsdstats_FLAGS?=-nodelay

bsdstats: _service_plain
bsdstats_exit:
1
2
3
4
DAEMON_cron_COMMAND?=/usr/sbin/cron
DAEMON_cron_FLAGS?=-s

cron: _service LOGIN



|
1
2
3
4
DAEMON_cron_COMMAND?=/usr/sbin/cron
DAEMON_cron_FLAGS?=-s

cron: ${_SERVICE} LOGIN
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
_service_daemon: .USE










	daemon -c -u ${DAEMON_$@_USER:Uroot} -r -P /var/run/daemon.$@.pid ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON$@_FOREGROUND}

_service_daemon_status: .USE
	echo "Not supported yet."


_service_daemon_exit: .USEBEFORE
	kill -TERM /var/run/daemon.$@.pid
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
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}

	/usr/local/bin/dbus-uuidgen --ensure
	mkdir -p /var/run/dbus

dbus_exit: ${_SERVICE_EXIT} slim_exit
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
6
DAEMON_devd_COMMAND?=/sbin/devd
DAEMON_devd_ENABLE?=yes
DAEMON_devd_FOREGROUND?=-dq

devd: ${_EARLYSERVICE}
	sysctl hw.bus.devctl_disable=1
1
2
3
4
5
6
7



DAEMON_dhcpcd_COMMAND?=/sbin/dhcpcd
DAEMON_dhcpcd_ENABLE?=no
DAEMON_dhcpcd_FLAGS?="-h${HOSTNAME}"
DAEMON_dhcpcd_BACKGROUND?=-b
DAEMON_dhcpcd_FOREGROUND?=-B

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









|
>
>
>
1
2
3
4
5
6
7
8
9
10
DAEMON_dhcpcd_COMMAND?=/sbin/dhcpcd
DAEMON_dhcpcd_ENABLE?=no
DAEMON_dhcpcd_FLAGS?="-h${HOSTNAME}"
DAEMON_dhcpcd_BACKGROUND?=-b
DAEMON_dhcpcd_FOREGROUND?=-B

dhcpcd: ${_SERVICE} NETWORK SERVICE # mount -> SERVICE, cleanvar -> SERVICE

NETWORK_EXIT: dhcpcd_exit
SERVICE_EXIT: dhcpcd_exit
1
2
3

4

DAEMON_dntpd_COMMAND?=/usr/sbin/dntpd
DAEMON_dntpd_FOREGROUND?=-F


dntpd: _service NETWORK




>
|
>
1
2
3
4
5
6
DAEMON_dntpd_COMMAND?=/usr/sbin/dntpd
DAEMON_dntpd_FOREGROUND?=-F

dntpd: ${_SERVICE} NETWORK

NETWORK_EXIT: dntpd_exit
1
2
3
4

5

DAEMON_inetd_COMMAND?=/usr/sbin/inetd
DAEMON_inetd_enable?=no
DAEMON_inetd_FLAGS?=-C 60


inetd: _service LOGIN





>
|
>
1
2
3
4
5
6
7
DAEMON_inetd_COMMAND?=/usr/sbin/inetd
DAEMON_inetd_enable?=no
DAEMON_inetd_FLAGS?=-C 60

inetd: ${_SERVICE} LOGIN

LOGIN_EXIT: inetd_exit
Modified init.mk from [b90d2e56a7] to [86dd3c18d7].
1
2
3
4
5
6


7
8
9
10
11
12
13
# Meta targets

TARGETS+=adjkerntz bootfs cleanvar cleartmp cloned devfs dmesg dumpon fsck \
	hostname kld ldconfig microcode mixer mount mountlate msgs netif \
	newsyslog nextboot nfsclient pf pwcheck random root rpc_umntall runshm \
	savecore swap sysctl sysdb wlans zfs



DAEMON: pwcheck sysctl sysdb NETWORK SERVERS ldconfig nfsclient cleartmp pflogd

LOGIN: DAEMON dntpd msgs powerd pflogd

NETWORK: netif devd hostname



|

|
|
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Meta targets

TARGETS:=adjkerntz bootfs cleanvar cleartmp cloned devfs dmesg dumpon fsck \
	hostname kld ldconfig microcode mixer mount mountlate msgs netif \
	newsyslog nextboot nfsclient pf pwcheck random root runshm savecore swap \
	sysctl sysdb wlans zfs

OTHER_TARGETS+=mixer_exit nfsclient_exit random_exit

DAEMON: pwcheck sysctl sysdb NETWORK SERVERS ldconfig nfsclient cleartmp pflogd

LOGIN: DAEMON dntpd msgs powerd pflogd

NETWORK: netif devd hostname

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117

118
119
120
121
122
123
124
	test -d ${dir} && find ${dir} -mindepth 1 -delete || true
.endfor
	install -m644 /dev/null /var/run/utmpx

cleartmp: mountlate
	echo "MRC:$@> Clearing tmp."; \
	find -x /tmp -mindepth 1 ! -name lost+found \
	    ! -name snapshots ! -path "./snapshots/*" \
	    ! -name quota.user ! -name quota.group \
	    -delete -type d -prune ;\
	  rm -f /tmp/.X*-lock ;\
	  rm -fr /tmp/.X11-unix ;\
	  mkdir -m 1777 /tmp/.X11-unix

cloned: kld
.if !empty(CLONED_INTERFACES)
	echo "MRC:$@> Cloning interfaces: ${CLONED_INTERFACES}"
.for iface in ${CLONED_INTERFACES}
	ifconfig ${iface} create
.endfor
.endif

devfs:
	echo "MRC:$@> Applying rules: ${DEVFS_CONFIG_FILES}"
.for file in ${DEVFS_CONFIG_FILES}
.if exists(${file})
	devfsctl -a -f ${file}
.endif
.endfor

dmesg: mountlate
.if !empty(DMESG_FILE)
	echo "MRC:$@> Writing dmesg."
	umask 022 ; dmesg -a >> ${DMESG_FILE}
.endif

dumpon: random
.if !empty(DUMPDEV)
	test -e ${DUMPDEV} && { \
	  echo "MRC:$@> Setting dumpon device to ${DUMPDEV}"; \
	  dumpon -v ${DUMPDEV}; \
	} || true

.endif

fsck:
	echo "MRC:$@> Checking disks." ;\
	fsck -p ;\
	case $$? in \
	0) ;; \
	2) exit 1 \
	   ;; \
	4) echo "Rebooting..." ;\
	   reboot ;\
	   echo "Reboot failed; help!" ;\
	   exit 1 \
	   ;; \
	8) if [ -n "$${FSCK_Y_ENABLE}" ]; then \
	     echo "File system preen failed, trying fsck -y." ;\
	     fsck -y || {\
	       echo "Automatic file system check failed; help!" ;\
	       exit 1 ;\
	     }\
	   else \
	     echo "Automatic file system check failed; help!" ;\
	     exit 1 ;\
	   fi ;\
	   ;; \
	12) echo "Boot interrupted." ;\
	   exit 1 \
	   ;; \
	130) exit 1 \
	   ;; \
	*) echo "Unknown error, help!" ;\
	   exit 1 \
	   ;; \
	esac

hostname:
	echo "MRC:$@> Setting to ${HOSTNAME}."
	hostname ${HOSTNAME}

kld: bootfs
.if defined(KLD_LIST)
	echo "MRC:$@> Loading kernel modules: ${KLD_LIST}"
	kldload -n ${KLD_LIST}
.endif


.for path in ${LDCONFIG_PATHS} /etc/ld-elf.so.conf
.if exists(${path})
ldc+=${path}
.endif
.endfor

.for dir in ${LDCONFIG_LOCAL_DIRS}







|
|
|
|
|
|




|

|





|

|










|
|
|
<
>








|

|
|
|
|

|
|
|
|
|
|
|
|
|
|

|
|

|

|
|








|



>







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
	test -d ${dir} && find ${dir} -mindepth 1 -delete || true
.endfor
	install -m644 /dev/null /var/run/utmpx

cleartmp: mountlate
	echo "MRC:$@> Clearing tmp."; \
	find -x /tmp -mindepth 1 ! -name lost+found \
			! -name snapshots ! -path "./snapshots/*" \
			! -name quota.user ! -name quota.group \
			-delete -type d -prune ;\
		rm -f /tmp/.X*-lock ;\
		rm -fr /tmp/.X11-unix ;\
		mkdir -m 1777 /tmp/.X11-unix

cloned: kld
.if !empty(CLONED_INTERFACES)
	echo "MRC:$@> Cloning interfaces: ${CLONED_INTERFACES}"
.	for iface in ${CLONED_INTERFACES}
	ifconfig ${iface} create
.	endfor
.endif

devfs:
	echo "MRC:$@> Applying rules: ${DEVFS_CONFIG_FILES}"
.for file in ${DEVFS_CONFIG_FILES}
.	if exists(${file})
	devfsctl -a -f ${file}
.	endif
.endfor

dmesg: mountlate
.if !empty(DMESG_FILE)
	echo "MRC:$@> Writing dmesg."
	umask 022 ; dmesg -a >> ${DMESG_FILE}
.endif

dumpon: random
.if !empty(DUMPDEV)
	if [ -e ${DUMPDEV} ]; then \
		echo "MRC:$@> Setting dumpon device to ${DUMPDEV}"; \
		dumpon -v ${DUMPDEV}; \

	fi
.endif

fsck:
	echo "MRC:$@> Checking disks." ;\
	fsck -p ;\
	case $$? in \
	0) ;; \
	2) exit 1 \
		;; \
	4) echo "Rebooting..." ;\
		reboot ;\
		echo "Reboot failed; help!" ;\
		exit 1 \
		;; \
	8) if [ -n "$${FSCK_Y_ENABLE}" ]; then \
			echo "File system preen failed, trying fsck -y." ;\
			fsck -y || {\
				echo "Automatic file system check failed; help!" ;\
				exit 1 ;\
			} ;\
		else \
			echo "Automatic file system check failed; help!" ;\
			exit 1 ;\
		fi \
		;; \
	12) echo "Boot interrupted." ;\
		exit 1 \
		;; \
	130) exit 1 \
		;; \
	*) echo "Unknown error, help!" ;\
		exit 1 \
		;; \
	esac

hostname:
	echo "MRC:$@> Setting to ${HOSTNAME}."
	hostname ${HOSTNAME}

kld: bootfs
.if defined(KLD_LIST)
	echo "MRC:$@> Loading kernel modules: ${KLD_LIST}" ;\
	kldload -n ${KLD_LIST}
.endif

# ldconfig
.for path in ${LDCONFIG_PATHS} /etc/ld-elf.so.conf
.if exists(${path})
ldc+=${path}
.endif
.endfor

.for dir in ${LDCONFIG_LOCAL_DIRS}
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

152










153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174

175
176
177
178
179
180
181
182
183
184
185
186
187











188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208




209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227

228
229

230
231








232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
	ldconfig -elf ${ldc}

microcode: mountlate
	test -d /usr/local/share/cpucontrol || exit 0 ;\
	echo "MRC:$@> Updating microcode." ;\
	kldload -n cpuctl || exit 1 ;\
	for cpu in $$(jot ${NCPU} 0); do \
	  ( cpucontrol -u -d /usr/local/share/cpucontrol /dev/cpuctl$${cpu} \
	    || exit 1 \
	  ) | grep -v '^TEST' ;\
	  cpucontrol -e /dev/cpuctl$${cpu} || exit 1 ;\
	done

mixers=${:!find /dev -name 'mixer*'!:S/\/dev\///}

mixer: mount cleanvar
	echo "MRC:$@> Restoring levels."
.for mixer in ${mixers}
	test -f /var/db/${mixer}-state || true && mixer -f /dev/${mixer} \
	  `cat /var/db/${mixer}-state`

.endfor











excludes=${NETFS_TYPES:C/:.*//}

mount: root zfs
	echo "MRC:$@> Mount local FS." ;\
	mount -uo rw -a ;\
	mount ;\
	mount -a -t no${excludes:ts,}

mountlate: NETWORK mount cleanvar runshm devd
	echo "MRC:$@> Mount late FS." ;\
	mount -a

msgs: mount
	echo "MRC:$@> Making bounds." ;\
	  test ! -d /var/msgs -o -f /var/msgs/bound -o -L /var/msgs/bounds || \
	  echo 0 > /var/msgs/bounds

newsyslog: mountlate sysdb
	test -z "$${NEWSYSLOG_ENABLE}" || \
	  echo "MRC:$@> Trimming log files." ;\
	  /usr/sbin/newsyslog ${NEWSYSLOG_FLAGS}


nextboot: mount
.if exists(/boot/nextkernel)
	echo "MRC:$@> Removing nextboot setting."
	rm -f /boot/nextkernel
.endif

.if empty(NFSCLIENT_ENABLE:tl:Mno)
DAEMON_rpcbind_ENABLE=yes
.endif

nfsclient: NETWORK rpcbind rpc_umntall
	test -z "$${NFSCLIENT_ENABLE}" || kldload -n nfs












netif: adjkerntz wlans cloned kld
	echo "MRC:$@> Starting interfaces: ${IFCONFIG_IFACES}"
.for iface in ${IFCONFIG_IFACES}
.for item in ${IFCONFIG_${iface}:tW:ts;}
	ifconfig ${iface} ${item}
.endfor
.undef _IFCONFIG_ARGS
.endfor

pf: pflogd
.if empty(PF_ENABLE:tl:Mno)
	echo "MRC:$@> Enabling and loading rules." ;\
	kldload -n pf || exit 1 ;\
	test -r ${PF_RULES} || {\
	  echo "MRC:$@> Can't find file with rules at ${PF_RULES}." ;\
	  exit 1 ;\
	} ;\
	pfctl -Fa || exit 1 ;\
	pfctl -f ${PF_RULES} ${PF_FLAGS} || exit 1 ;\
	pfctl -Si | grep -q Enabled && pfctl -e




.endif

pwcheck: mountlate syslogd
	echo "MRC:$@> Checking password lock file."
.if exists(/etc/ptmp)
	logger -s -p auth.err "password file may be incorrect -- /etc/ptmp \
	  exists"
.endif

random: mount devfs
	echo "MRC:$@> Seeding." ;\
	sysctl kern.seedenable=1 > /dev/null ;\
	( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww; ) 2>&1 | \
	  dd status=none of=/dev/random bs=8k ;\
	dd if=/bin/ps status=none of=/dev/random bs=8k ;\
	test -d $${ENTROPY_DIR} && {\
	  find $${ENTROPY_DIR} -type f |\
	  xargs -n1 -Ifoo dd status=none if=foo of=/dev/random bs=8k ;\
	} || {\

	  dd status=none if=${ENTROPY_FILE} of=/dev/random bs=8k ;\
	} ;\

	sysctl kern.seedenable=0 > /dev/null









root: fsck bootfs
	echo "MRC:$@> Mount root R/W." ;\
	mount -uo rw

rpc_umntall: mountlate NETWORK rpcbind
.if empty(RPC_UMNTALL_ENABLE:tl:Mno)
	echo "MRC:$@> Sending RPC unmount notifications."; \
	test -f /var/db/mounttab || true && \
	  rpc.umntall -k &
.endif

runshm: cleanvar
	echo "MRC:$@> Mount and populate /var/run/shm."; \
	mkdir -p /var/run/shm; \
	mount_tmpfs -m 01777 dummy /var/run/shm; \
	mkdir -p -m 01777 /var/run/shm/tmp; \

savecore: dumpon







|
|
|
|







|
|
>

>
>
>
>
>
>
>
>
>
>















|
|


|
|
|
>











|
|
>
>
>
>
>
>
>
>
>
>
>














|
<
<
<
|
|
|
>
>
>
>





|
|





|
|

|
|
|
|
>
|
|
>


>
>
>
>
>
>
>
>




<
<
<
<
<
<
<







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272







273
274
275
276
277
278
279
	ldconfig -elf ${ldc}

microcode: mountlate
	test -d /usr/local/share/cpucontrol || exit 0 ;\
	echo "MRC:$@> Updating microcode." ;\
	kldload -n cpuctl || exit 1 ;\
	for cpu in $$(jot ${NCPU} 0); do \
		{ cpucontrol -u -d /usr/local/share/cpucontrol /dev/cpuctl$${cpu} \
			|| exit 1 ;\
		} | grep -v '^TEST' ;\
		cpucontrol -e /dev/cpuctl$${cpu} || exit 1 ;\
	done

mixers=${:!find /dev -name 'mixer*'!:S/\/dev\///}

mixer: mount cleanvar
	echo "MRC:$@> Restoring levels."
.for mixer in ${mixers}
	if [ -r /var/db/${mixer}-state ]; then \
		mixer -f /dev/${mixer} `cat /var/db/${mixer}-state` ;\
	fi
.endfor

mixer_exit:
	echo "MRC:$@> Saving mixer levels."
.for mixer in ${mixers}
	if [ -r /dev/${mixer} ]; then \
		mixer -f /dev/${mixer} -s > /var/db/${mixer}-state ;\
	fi
.endfor

DAEMON_EXIT: mixer_exit

excludes=${NETFS_TYPES:C/:.*//}

mount: root zfs
	echo "MRC:$@> Mount local FS." ;\
	mount -uo rw -a ;\
	mount ;\
	mount -a -t no${excludes:ts,}

mountlate: NETWORK mount cleanvar runshm devd
	echo "MRC:$@> Mount late FS." ;\
	mount -a

msgs: mount
	echo "MRC:$@> Making bounds." ;\
		test ! -d /var/msgs -o -f /var/msgs/bound -o -L /var/msgs/bounds || \
		echo 0 > /var/msgs/bounds

newsyslog: mountlate sysdb
	if [ -n "$${NEWSYSLOG_ENABLE}" ]; then \
		echo "MRC:$@> Trimming log files." ;\
		/usr/sbin/newsyslog ${NEWSYSLOG_FLAGS} ;\
	fi

nextboot: mount
.if exists(/boot/nextkernel)
	echo "MRC:$@> Removing nextboot setting."
	rm -f /boot/nextkernel
.endif

.if empty(NFSCLIENT_ENABLE:tl:Mno)
DAEMON_rpcbind_ENABLE=yes
.endif

nfsclient: NETWORK rpcbind
	if [ -n "$${NFSCLIENT_ENABLE}" ]; then \
		kldload -n nfs ;\
	fi

nfsclient_exit: DAEMON_EXIT
.if empty(RPC_UMNTALL_ENABLE:tl:Mno)
	echo "MRC:$@> Sending RPC unmount notifications."; \
	test -f /var/db/mounttab || true && \
		rpc.umntall -k
.endif

NETWORK_EXIT: nfsclient_exit

netif: adjkerntz wlans cloned kld
	echo "MRC:$@> Starting interfaces: ${IFCONFIG_IFACES}"
.for iface in ${IFCONFIG_IFACES}
.for item in ${IFCONFIG_${iface}:tW:ts;}
	ifconfig ${iface} ${item}
.endfor
.undef _IFCONFIG_ARGS
.endfor

pf: pflogd
.if empty(PF_ENABLE:tl:Mno)
	echo "MRC:$@> Enabling and loading rules." ;\
	kldload -n pf || exit 1 ;\
	if [ -r ${PF_RULES} ]; then \



		pfctl -Fa || exit 1 ;\
		pfctl -f ${PF_RULES} ${PF_FLAGS} || exit 1 ;\
		pfctl -Si | grep -q Enabled && pfctl -e; \
	else \
		echo "MRC:$@> Can't find file with rules at ${PF_RULES}." ;\
		exit 1 ;\
	fi
.endif

pwcheck: mountlate syslogd
	echo "MRC:$@> Checking password lock file."
.if exists(/etc/ptmp)
	logger -s -p auth.err \
		"password file may be incorrect -- /etc/ptmp exists"
.endif

random: mount devfs
	echo "MRC:$@> Seeding." ;\
	sysctl kern.seedenable=1 > /dev/null ;\
	{ ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww; } 2>&1 | \
		dd status=none of=/dev/random bs=8k ;\
	dd if=/bin/ps status=none of=/dev/random bs=8k ;\
	if [ -d $${ENTROPY_DIR} ]; then \
		find $${ENTROPY_DIR} -type f |\
			xargs -n1 -Ifoo dd status=none if=foo of=/dev/random bs=8k ;\
	else \
		if [ -r ${ENTROPY_FILE} ]; then \
			dd status=none if=${ENTROPY_FILE} of=/dev/random bs=8k ;\
		fi ;\
	fi ;\
	sysctl kern.seedenable=0 > /dev/null

random_exit:
	rm -f ${ENTROPY_FILE}; \
	umask 077 && \
	dd if=/dev/random of=${ENTROPY_FILE} bs=8k count=1 || \
		echo "MRC:$@> entropy file write failed."

DAEMON_EXIT: random_exit

root: fsck bootfs
	echo "MRC:$@> Mount root R/W." ;\
	mount -uo rw








runshm: cleanvar
	echo "MRC:$@> Mount and populate /var/run/shm."; \
	mkdir -p /var/run/shm; \
	mount_tmpfs -m 01777 dummy /var/run/shm; \
	mkdir -p -m 01777 /var/run/shm/tmp; \

savecore: dumpon
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
	swapon -a
.endif

sysctl: kld root
.if exists(/etc/sysctl.conf)
	echo "MRC:$@> Setting sysctl defaults."; \
	awk '$$0~/^[ ]*(#.*)?$$/{next}{print}' < /etc/sysctl.conf | \
	  xargs -n1 sysctl
.endif

sysdb: mountlate
	echo "MRC:$@> Building databases."; \
	install -c -m 644 -g wheel /dev/null /var/run/utmpx

wlans: kld
	echo "MRC:$@> Configuring wlans."; \
	for dev in $$(sysctl -n net.wlan.devices); do \
	  eval all_wlans=\$${WLANS_$${dev}}; \
	  for wlan in $${all_wlans}; do \
	    eval wlan_args=\$${WLANS_$${wlan}_ARGS}; \
	    ifconfig $${wlan} create wlandev $${dev} $${wlan_args}; \
	    ifconfig $${wlan} up; \
	  done; \
	done

zfs:
.if empty(ZFS_ENABLE:tl:Mno)
	zfs mount -va || exit $$? ;\
	zfs share -a || exit $$? ;\
	test -r /etc/zfs/exports || touch /etc/zfs/exports
.endif







|









|
|
|
|
|
|








291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
	swapon -a
.endif

sysctl: kld root
.if exists(/etc/sysctl.conf)
	echo "MRC:$@> Setting sysctl defaults."; \
	awk '$$0~/^[ ]*(#.*)?$$/{next}{print}' < /etc/sysctl.conf | \
		xargs -n1 sysctl
.endif

sysdb: mountlate
	echo "MRC:$@> Building databases."; \
	install -c -m 644 -g wheel /dev/null /var/run/utmpx

wlans: kld
	echo "MRC:$@> Configuring wlans."; \
	for dev in $$(sysctl -n net.wlan.devices); do \
		eval all_wlans=\$${WLANS_$${dev}}; \
		for wlan in $${all_wlans}; do \
			eval wlan_args=\$${WLANS_$${wlan}_ARGS}; \
			ifconfig $${wlan} create wlandev $${dev} $${wlan_args}; \
			ifconfig $${wlan} up; \
		done; \
	done

zfs:
.if empty(ZFS_ENABLE:tl:Mno)
	zfs mount -va || exit $$? ;\
	zfs share -a || exit $$? ;\
	test -r /etc/zfs/exports || touch /etc/zfs/exports
.endif
1
2
3
4
5
6
7
8
9
10
11
12

13



DAEMON_mountd_COMMAND?=/sbin/mountd
DAEMON_mountd_ENABLE?=no
DAEMON_mountd_FLAGS?=-r

.if empty(DAEMON_mountd_ENABLE:tl:Mno)
DAEMON_rpcbind_ENABLE=yes
.endif

mountd: rpcbind NETWORK SERVERS _service # mountlate -> SERVERS
	test -z "$${DAEMON_$@_ENABLE}" || { \
	  rm -f /var/db/mountdtab; \
	  ( umask 022 ; touch /var/db/mountdtab ); \

	}











|
<
|
|
>
|
>
>
>
1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
DAEMON_mountd_COMMAND?=/sbin/mountd
DAEMON_mountd_ENABLE?=no
DAEMON_mountd_FLAGS?=-r

.if empty(DAEMON_mountd_ENABLE:tl:Mno)
DAEMON_rpcbind_ENABLE=yes
.endif

mountd: rpcbind NETWORK SERVERS ${_SERVICE} # mountlate -> SERVERS

	rm -f /var/db/mountdtab ;\
	( umask 022; touch /var/db/mountdtab; ) ;\
	:

mountd_exit: ${_SERVICE_EXIT} nfsd_exit

NETWORK_EXIT: mountd_exit
1
2
3
4
5
6
7
8
9
10
11
12
13


DAEMON_nfsd_COMMAND?=/sbin/nfsd
DAEMON_nfsd_ENABLE?=no
DAEMON_nfsd_FLAGS?=-u -t -n 4

.if empty(DAEMON_nfsd_ENABLE:tl:Mno)
DAEMON_rpcbind_ENABLE=yes
DAEMON_mountd_ENABLE=yes
.endif

nfsd: mountd _service rpcbind
.if empty(NFS_RESERVED_PORT_ONLY:tl:Mno)
	sysctl vfs.nfs.nfs_privport=1
.endif











|



>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DAEMON_nfsd_COMMAND?=/sbin/nfsd
DAEMON_nfsd_ENABLE?=no
DAEMON_nfsd_FLAGS?=-u -t -n 4

.if empty(DAEMON_nfsd_ENABLE:tl:Mno)
DAEMON_rpcbind_ENABLE=yes
DAEMON_mountd_ENABLE=yes
.endif

nfsd: mountd ${_SERVICE} rpcbind
.if empty(NFS_RESERVED_PORT_ONLY:tl:Mno)
	sysctl vfs.nfs.nfs_privport=1
.endif

nfsd_exit:
1
2
3
4
5
6
7
8
9
10
DAEMON_node_exporter_COMMAND?=/usr/local/bin/node_exporter --web.listen-address=${DAEMON_node_exporter_LISTEN_ADDRESS} --collector.textfile.directory=${DAEMON_node_exporter_TEXTFILE_DIR}
DAEMON_node_exporter_ENABLE?=no
DAEMON_node_exporter_LISTEN_ADDRESS?=:9100
DAEMON_node_exporter_TEXTFILE_DIR?=/var/tmp/node_exporter
DAEMON_node_exporter_USER?=nobody
DAEMON_node_exporter_GROUP?=nobody

node_exporter: _service
	test -z "$${DAEMON_$@_ENABLE}" || \
	install -d -o ${DAEMON_node_exporter_USER} -g ${DAEMON_node_exporter_GROUP} -m1755 ${DAEMON_node_exporter_TEXTFILE_DIR}







|
<

1
2
3
4
5
6
7
8

9
DAEMON_node_exporter_COMMAND?=/usr/local/bin/node_exporter --web.listen-address=${DAEMON_node_exporter_LISTEN_ADDRESS} --collector.textfile.directory=${DAEMON_node_exporter_TEXTFILE_DIR}
DAEMON_node_exporter_ENABLE?=no
DAEMON_node_exporter_LISTEN_ADDRESS?=:9100
DAEMON_node_exporter_TEXTFILE_DIR?=/var/tmp/node_exporter
DAEMON_node_exporter_USER?=nobody
DAEMON_node_exporter_GROUP?=nobody

node_exporter: ${_SERVICE}

	install -d -o ${DAEMON_node_exporter_USER} -g ${DAEMON_node_exporter_GROUP} -m1755 ${DAEMON_node_exporter_TEXTFILE_DIR}
Added order.mk version [abc734c55f].
1
2
3
4
5
6
7
8
9
10
11
12
13
DAEMON_pflogd_COMMAND?=/sbin/pflogd
DAEMON_pflogd_MODULES?=pf
DAEMON_pflogd_FLAGS?=-f /var/log/pflog

pflogd: root mount netif
.if !empty(DAEMON_pflog_ENABLE:tl:Mno)
	echo "MRC:$@> Configuring device." ;\
	kldload -n pf || exit 1 ;\
	ifconfig pflog0 up || { \
	  echo "MRC:$@> Failed to set up pflog0 device." ;\
	  exit 1 ;\
	}
.endif









|
|


1
2
3
4
5
6
7
8
9
10
11
12
13
DAEMON_pflogd_COMMAND?=/sbin/pflogd
DAEMON_pflogd_MODULES?=pf
DAEMON_pflogd_FLAGS?=-f /var/log/pflog

pflogd: root mount netif
.if !empty(DAEMON_pflog_ENABLE:tl:Mno)
	echo "MRC:$@> Configuring device." ;\
	kldload -n pf || exit 1 ;\
	ifconfig pflog0 up || { \
		echo "MRC:$@> Failed to set up pflog0 device." ;\
		exit 1 ;\
	}
.endif
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
6

7
8
_service_plain: .USE










	chroot -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} / ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON_$@_BACKGROUND}


_service_status: .USE
	echo "Plain service status doesn't work right now."


_service_exit: .USEBEFORE
	echo "Plain service exit doesn't work right now."
Added rc.shutdown version [9336dbdccb].
1
2
3
4
5




DAEMON_rpcbind_COMMAND?=/usr/sbin/rpcbind
DAEMON_rpcbind_ENABLE?=no
DAEMON_rpcbind_FLAGS?=-d

rpcbind: _earlyservice NETWORK syslogd








|
>
>
>
>
1
2
3
4
5
6
7
8
9
DAEMON_rpcbind_COMMAND?=/usr/sbin/rpcbind
DAEMON_rpcbind_ENABLE?=no
DAEMON_rpcbind_FLAGS?=-d

rpcbind: ${_EARLYSERVICE} NETWORK syslogd

rpcbind_exit: ${_SERVICE_EXIT} mountd_exit nfsd_exit

NETWORK_EXIT: rpcbind_exit
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
DAEMON_slim_COMMAND?=/usr/local/bin/slim
DAEMON_slim_ENABLE?=no
DAEMON_slim_BACKGROUND?=-d

slim: ${_SERVICE} dbus
	rm -f /var/run/slim.auth

DAEMON_EXIT: slim_exit
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." ; \
	  exit 1; \
	}






|
<
|
|
|
<
>
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
DAEMON_smartd_FOREGROUND?=-n

smartd: ${_SERVICE}

	if [ ! -f /usr/local/etc/smartd.conf ]; then \
		echo "MRC:$@> smartd requires config file to start."; \
		exit 1; \

	fi
Added starter.mk version [d6bb3354cb].
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32


LOCAL_TARGETS:=_service_svc _earlyservice_svc
STATUS_TARGETS:=_status_svc
RESTART_TARGETS:=_restart_svc
OTHER_TARGETS+=${LOCAL_TARGETS} ${STATUS_TARGETS} ${RESTART_TARGETS}
.if ${STARTER} == "svc"
LOCAL_TARGETS+=_service _earlyservice
STATUS_TARGETS+=_status
RESTART_TARGETS+=_restart
.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} ${DAEMON_$@_RESTART:D-r} ${DAEMON_$@_RESTART} init $@ ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON_$@_FOREGROUND}; \
	}
.endfor

.for target in ${RESTART_TARGETS}
${target}: .USE
	svc restart $@
.endfor

.for target in ${STATUS_TARGETS}
${target}: .USE
	svc status $@
.endfor

.undef LOCAL_TARGETS
.undef RESTART_TARGETS
.undef STATUS_TARGETS


|
<
<
<
<
<
<
<
<
|
<
<
<
<
<
|
|
<
|
<
<
<
<
<
<
<

<

<
<
<
>
>
1








2





3
4

5







6

7



8
9
_service_svc: .USE








	svc list $@ | grep -q $@ || \





	svc -u ${DAEMON_$@_USER:Uroot} -g ${DAEMON_$@_GROUP:Uwheel} ${DAEMON_$@_RESTART:D-r} ${DAEMON_$@_RESTART} init $@ ${DAEMON_$@_COMMAND} ${DAEMON_$@_FLAGS} ${DAEMON_$@_FOREGROUND}


_service_svc_status: .USE







	svc status $@





_service_svc_exit: .USEBEFORE
	svc exit $@
1
2
3
4
5
DAEMON_syslogd_COMMAND?=/usr/sbin/syslogd
DAEMON_syslogd_ENABLE?=yes
DAEMON_syslogd_FLAGS?=-ss8cc

syslogd: _earlyservice newsyslog




|
1
2
3
4
5
DAEMON_syslogd_COMMAND?=/usr/sbin/syslogd
DAEMON_syslogd_ENABLE?=yes
DAEMON_syslogd_FLAGS?=-ss8cc

syslogd: ${_EARLYSERVICE} newsyslog
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








|
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}