Origin for each line in
init.mk
from check-in d332ed9f4a:
295630c60d 2019-10-23 1: # Meta targets
295630c60d 2019-10-23 2:
8f8bbe5cbb 2019-10-25 3: TARGETS+=adjkerntz bootfs cleanvar cleartmp cloned devfs dmesg dumpon fsck \
0be859974c 2019-10-25 4: hostname kld ldconfig microcode mixer mount mountlate msgs netif \
0be859974c 2019-10-25 5: newsyslog nextboot nfsclient pf pwcheck random root rpc_umntall runshm \
cda92733d7 2019-10-25 6: savecore swap sysctl sysdb wlans zfs
0be859974c 2019-10-25 7:
0be859974c 2019-10-25 8: DAEMON: pwcheck sysctl sysdb NETWORK SERVERS ldconfig nfsclient cleartmp pflogd
0be859974c 2019-10-25 9:
0be859974c 2019-10-25 10: LOGIN: DAEMON dntpd msgs powerd pflogd
0be859974c 2019-10-25 11:
0be859974c 2019-10-25 12: NETWORK: netif devd hostname
295630c60d 2019-10-23 13:
295630c60d 2019-10-23 14: SERVERS: swap mountlate syslogd newsyslog
295630c60d 2019-10-23 15:
0be859974c 2019-10-25 16: SERVICE: netif mount random hostname cleanvar
295630c60d 2019-10-23 17:
295630c60d 2019-10-23 18: # regular targets
295630c60d 2019-10-23 19:
295630c60d 2019-10-23 20: adjkerntz: random mount
295630c60d 2019-10-23 21: echo "MRC:$@> Adjust kernel timezone."
295630c60d 2019-10-23 22: adjkerntz -i
295630c60d 2019-10-23 23:
295630c60d 2019-10-23 24: bootfs: fsck
295630c60d 2019-10-23 25: echo "MRC:$@> Checking whether we need /boot mounted."
295630c60d 2019-10-23 26: mount -vadr | grep -q ' /boot$$' && mount -r /boot || true
295630c60d 2019-10-23 27:
295630c60d 2019-10-23 28: cleanvar: mount
295630c60d 2019-10-23 29: echo "MRC:$@> Cleaning 'var's."
295630c60d 2019-10-23 30: .for dir in ${CLEANVAR_DIRS}
527b45759d 2019-10-24 31: test -d ${dir} && find ${dir} -mindepth 1 -delete || true
295630c60d 2019-10-23 32: .endfor
295630c60d 2019-10-23 33: install -m644 /dev/null /var/run/utmpx
295630c60d 2019-10-23 34:
295630c60d 2019-10-23 35: cleartmp: mountlate
295630c60d 2019-10-23 36: echo "MRC:$@> Clearing tmp."; \
295630c60d 2019-10-23 37: find -x /tmp -mindepth 1 ! -name lost+found \
295630c60d 2019-10-23 38: ! -name snapshots ! -path "./snapshots/*" \
295630c60d 2019-10-23 39: ! -name quota.user ! -name quota.group \
295630c60d 2019-10-23 40: -delete -type d -prune ;\
295630c60d 2019-10-23 41: rm -f /tmp/.X*-lock ;\
295630c60d 2019-10-23 42: rm -fr /tmp/.X11-unix ;\
295630c60d 2019-10-23 43: mkdir -m 1777 /tmp/.X11-unix
295630c60d 2019-10-23 44:
295630c60d 2019-10-23 45: cloned: kld
88e0b45310 2019-10-23 46: .if !empty(CLONED_INTERFACES)
295630c60d 2019-10-23 47: echo "MRC:$@> Cloning interfaces: ${CLONED_INTERFACES}"
295630c60d 2019-10-23 48: .for iface in ${CLONED_INTERFACES}
295630c60d 2019-10-23 49: ifconfig ${iface} create
295630c60d 2019-10-23 50: .endfor
88e0b45310 2019-10-23 51: .endif
295630c60d 2019-10-23 52:
295630c60d 2019-10-23 53: devfs:
295630c60d 2019-10-23 54: echo "MRC:$@> Applying rules: ${DEVFS_CONFIG_FILES}"
295630c60d 2019-10-23 55: .for file in ${DEVFS_CONFIG_FILES}
295630c60d 2019-10-23 56: .if exists(${file})
295630c60d 2019-10-23 57: devfsctl -a -f ${file}
295630c60d 2019-10-23 58: .endif
295630c60d 2019-10-23 59: .endfor
295630c60d 2019-10-23 60:
295630c60d 2019-10-23 61: dmesg: mountlate
88e0b45310 2019-10-23 62: .if !empty(DMESG_FILE)
295630c60d 2019-10-23 63: echo "MRC:$@> Writing dmesg."
295630c60d 2019-10-23 64: umask 022 ; dmesg -a >> ${DMESG_FILE}
88e0b45310 2019-10-23 65: .endif
295630c60d 2019-10-23 66:
295630c60d 2019-10-23 67: dumpon: random
88e0b45310 2019-10-23 68: .if !empty(DUMPDEV)
295630c60d 2019-10-23 69: test -e ${DUMPDEV} && { \
295630c60d 2019-10-23 70: echo "MRC:$@> Setting dumpon device to ${DUMPDEV}"; \
295630c60d 2019-10-23 71: dumpon -v ${DUMPDEV}; \
295630c60d 2019-10-23 72: } || true
88e0b45310 2019-10-23 73: .endif
295630c60d 2019-10-23 74:
295630c60d 2019-10-23 75: fsck:
295630c60d 2019-10-23 76: echo "MRC:$@> Checking disks." ;\
295630c60d 2019-10-23 77: fsck -p ;\
295630c60d 2019-10-23 78: case $$? in \
295630c60d 2019-10-23 79: 0) ;; \
295630c60d 2019-10-23 80: 2) exit 1 \
295630c60d 2019-10-23 81: ;; \
295630c60d 2019-10-23 82: 4) echo "Rebooting..." ;\
295630c60d 2019-10-23 83: reboot ;\
295630c60d 2019-10-23 84: echo "Reboot failed; help!" ;\
295630c60d 2019-10-23 85: exit 1 \
295630c60d 2019-10-23 86: ;; \
295630c60d 2019-10-23 87: 8) if [ -n "$${FSCK_Y_ENABLE}" ]; then \
295630c60d 2019-10-23 88: echo "File system preen failed, trying fsck -y." ;\
295630c60d 2019-10-23 89: fsck -y || {\
295630c60d 2019-10-23 90: echo "Automatic file system check failed; help!" ;\
295630c60d 2019-10-23 91: exit 1 ;\
295630c60d 2019-10-23 92: }\
295630c60d 2019-10-23 93: else \
295630c60d 2019-10-23 94: echo "Automatic file system check failed; help!" ;\
295630c60d 2019-10-23 95: exit 1 ;\
295630c60d 2019-10-23 96: fi ;\
295630c60d 2019-10-23 97: ;; \
295630c60d 2019-10-23 98: 12) echo "Boot interrupted." ;\
295630c60d 2019-10-23 99: exit 1 \
295630c60d 2019-10-23 100: ;; \
295630c60d 2019-10-23 101: 130) exit 1 \
295630c60d 2019-10-23 102: ;; \
295630c60d 2019-10-23 103: *) echo "Unknown error, help!" ;\
295630c60d 2019-10-23 104: exit 1 \
295630c60d 2019-10-23 105: ;; \
295630c60d 2019-10-23 106: esac
295630c60d 2019-10-23 107:
295630c60d 2019-10-23 108: hostname:
295630c60d 2019-10-23 109: echo "MRC:$@> Setting to ${HOSTNAME}."
295630c60d 2019-10-23 110: hostname ${HOSTNAME}
295630c60d 2019-10-23 111:
295630c60d 2019-10-23 112: kld: bootfs
295630c60d 2019-10-23 113: .if defined(KLD_LIST)
295630c60d 2019-10-23 114: echo "MRC:$@> Loading kernel modules: ${KLD_LIST}"
295630c60d 2019-10-23 115: kldload -n ${KLD_LIST}
295630c60d 2019-10-23 116: .endif
295630c60d 2019-10-23 117:
295630c60d 2019-10-23 118: .for path in ${LDCONFIG_PATHS} /etc/ld-elf.so.conf
295630c60d 2019-10-23 119: .if exists(${path})
295630c60d 2019-10-23 120: ldc+=${path}
295630c60d 2019-10-23 121: .endif
295630c60d 2019-10-23 122: .endfor
295630c60d 2019-10-23 123:
295630c60d 2019-10-23 124: .for dir in ${LDCONFIG_LOCAL_DIRS}
295630c60d 2019-10-23 125: .if exists(${dir})
295630c60d 2019-10-23 126: ldc+=${:!find ${dir} -type f!}
295630c60d 2019-10-23 127: .endif
295630c60d 2019-10-23 128: .endfor
295630c60d 2019-10-23 129:
295630c60d 2019-10-23 130: ldconfig: mountlate
295630c60d 2019-10-23 131: echo "MRC:$@> Initializing shared libraries: ${ldc}"; \
295630c60d 2019-10-23 132: ldconfig -elf ${ldc}
295630c60d 2019-10-23 133:
8f8bbe5cbb 2019-10-25 134: microcode: mountlate
d332ed9f4a 2022-05-29 135: test -d /usr/local/share/cpucontrol || exit 0 ;\
d332ed9f4a 2022-05-29 136: echo "MRC:$@> Updating microcode." ;\
8f8bbe5cbb 2019-10-25 137: kldload -n cpuctl || exit 1 ;\
d332ed9f4a 2022-05-29 138: for cpu in $$(jot ${NCPU} 0); do \
35e11e77a2 2019-10-25 139: ( cpucontrol -u -d /usr/local/share/cpucontrol /dev/cpuctl$${cpu} \
d332ed9f4a 2022-05-29 140: || exit 1 \
35e11e77a2 2019-10-25 141: ) | grep -v '^TEST' ;\
8f8bbe5cbb 2019-10-25 142: cpucontrol -e /dev/cpuctl$${cpu} || exit 1 ;\
8f8bbe5cbb 2019-10-25 143: done
8f8bbe5cbb 2019-10-25 144:
295630c60d 2019-10-23 145: mixers=${:!find /dev -name 'mixer*'!:S/\/dev\///}
295630c60d 2019-10-23 146:
295630c60d 2019-10-23 147: mixer: mount cleanvar
295630c60d 2019-10-23 148: echo "MRC:$@> Restoring levels."
295630c60d 2019-10-23 149: .for mixer in ${mixers}
8f8bbe5cbb 2019-10-25 150: test -f /var/db/${mixer}-state || true && mixer -f /dev/${mixer} \
8f8bbe5cbb 2019-10-25 151: `cat /var/db/${mixer}-state`
295630c60d 2019-10-23 152: .endfor
295630c60d 2019-10-23 153:
295630c60d 2019-10-23 154: excludes=${NETFS_TYPES:C/:.*//}
295630c60d 2019-10-23 155:
cda92733d7 2019-10-25 156: mount: root zfs
d332ed9f4a 2022-05-29 157: echo "MRC:$@> Mount local FS." ;\
d332ed9f4a 2022-05-29 158: mount -uo rw -a ;\
d332ed9f4a 2022-05-29 159: mount ;\
295630c60d 2019-10-23 160: mount -a -t no${excludes:ts,}
295630c60d 2019-10-23 161:
295630c60d 2019-10-23 162: mountlate: NETWORK mount cleanvar runshm devd
d332ed9f4a 2022-05-29 163: echo "MRC:$@> Mount late FS." ;\
295630c60d 2019-10-23 164: mount -a
295630c60d 2019-10-23 165:
295630c60d 2019-10-23 166: msgs: mount
295630c60d 2019-10-23 167: echo "MRC:$@> Making bounds." ;\
295630c60d 2019-10-23 168: test ! -d /var/msgs -o -f /var/msgs/bound -o -L /var/msgs/bounds || \
295630c60d 2019-10-23 169: echo 0 > /var/msgs/bounds
295630c60d 2019-10-23 170:
295630c60d 2019-10-23 171: newsyslog: mountlate sysdb
295630c60d 2019-10-23 172: test -z "$${NEWSYSLOG_ENABLE}" || \
295630c60d 2019-10-23 173: echo "MRC:$@> Trimming log files." ;\
295630c60d 2019-10-23 174: /usr/sbin/newsyslog ${NEWSYSLOG_FLAGS}
295630c60d 2019-10-23 175:
295630c60d 2019-10-23 176: nextboot: mount
295630c60d 2019-10-23 177: .if exists(/boot/nextkernel)
295630c60d 2019-10-23 178: echo "MRC:$@> Removing nextboot setting."
295630c60d 2019-10-23 179: rm -f /boot/nextkernel
295630c60d 2019-10-23 180: .endif
295630c60d 2019-10-23 181:
295630c60d 2019-10-23 182: .if empty(NFSCLIENT_ENABLE:tl:Mno)
295630c60d 2019-10-23 183: DAEMON_rpcbind_ENABLE=yes
295630c60d 2019-10-23 184: .endif
295630c60d 2019-10-23 185:
295630c60d 2019-10-23 186: nfsclient: NETWORK rpcbind rpc_umntall
295630c60d 2019-10-23 187: test -z "$${NFSCLIENT_ENABLE}" || kldload -n nfs
295630c60d 2019-10-23 188:
0be859974c 2019-10-25 189: netif: adjkerntz wlans cloned kld
0be859974c 2019-10-25 190: echo "MRC:$@> Starting interfaces: ${IFCONFIG_IFACES}"
0be859974c 2019-10-25 191: .for iface in ${IFCONFIG_IFACES}
0be859974c 2019-10-25 192: .for item in ${IFCONFIG_${iface}:tW:ts;}
0be859974c 2019-10-25 193: ifconfig ${iface} ${item}
0be859974c 2019-10-25 194: .endfor
0be859974c 2019-10-25 195: .undef _IFCONFIG_ARGS
0be859974c 2019-10-25 196: .endfor
0be859974c 2019-10-25 197:
0be859974c 2019-10-25 198: pf: pflogd
0be859974c 2019-10-25 199: .if empty(PF_ENABLE:tl:Mno)
0be859974c 2019-10-25 200: echo "MRC:$@> Enabling and loading rules." ;\
0be859974c 2019-10-25 201: kldload -n pf || exit 1 ;\
0be859974c 2019-10-25 202: test -r ${PF_RULES} || {\
0be859974c 2019-10-25 203: echo "MRC:$@> Can't find file with rules at ${PF_RULES}." ;\
0be859974c 2019-10-25 204: exit 1 ;\
0be859974c 2019-10-25 205: } ;\
0be859974c 2019-10-25 206: pfctl -Fa || exit 1 ;\
0be859974c 2019-10-25 207: pfctl -f ${PF_RULES} ${PF_FLAGS} || exit 1 ;\
0be859974c 2019-10-25 208: pfctl -Si | grep -q Enabled && pfctl -e
0be859974c 2019-10-25 209: .endif
0be859974c 2019-10-25 210:
295630c60d 2019-10-23 211: pwcheck: mountlate syslogd
295630c60d 2019-10-23 212: echo "MRC:$@> Checking password lock file."
295630c60d 2019-10-23 213: .if exists(/etc/ptmp)
8f8bbe5cbb 2019-10-25 214: logger -s -p auth.err "password file may be incorrect -- /etc/ptmp \
8f8bbe5cbb 2019-10-25 215: exists"
295630c60d 2019-10-23 216: .endif
295630c60d 2019-10-23 217:
295630c60d 2019-10-23 218: random: mount devfs
0be859974c 2019-10-25 219: echo "MRC:$@> Seeding." ;\
0be859974c 2019-10-25 220: sysctl kern.seedenable=1 > /dev/null ;\
8f8bbe5cbb 2019-10-25 221: ( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww; ) 2>&1 | \
0be859974c 2019-10-25 222: dd status=none of=/dev/random bs=8k ;\
0be859974c 2019-10-25 223: dd if=/bin/ps status=none of=/dev/random bs=8k ;\
0be859974c 2019-10-25 224: test -d $${ENTROPY_DIR} && {\
0be859974c 2019-10-25 225: find $${ENTROPY_DIR} -type f |\
0be859974c 2019-10-25 226: xargs -n1 -Ifoo dd status=none if=foo of=/dev/random bs=8k ;\
0be859974c 2019-10-25 227: } || {\
0be859974c 2019-10-25 228: dd status=none if=${ENTROPY_FILE} of=/dev/random bs=8k ;\
0be859974c 2019-10-25 229: } ;\
295630c60d 2019-10-23 230: sysctl kern.seedenable=0 > /dev/null
295630c60d 2019-10-23 231:
295630c60d 2019-10-23 232: root: fsck bootfs
d332ed9f4a 2022-05-29 233: echo "MRC:$@> Mount root R/W." ;\
d332ed9f4a 2022-05-29 234: mount -uo rw
295630c60d 2019-10-23 235:
295630c60d 2019-10-23 236: rpc_umntall: mountlate NETWORK rpcbind
0be859974c 2019-10-25 237: .if empty(RPC_UMNTALL_ENABLE:tl:Mno)
295630c60d 2019-10-23 238: echo "MRC:$@> Sending RPC unmount notifications."; \
295630c60d 2019-10-23 239: test -f /var/db/mounttab || true && \
295630c60d 2019-10-23 240: rpc.umntall -k &
295630c60d 2019-10-23 241: .endif
295630c60d 2019-10-23 242:
295630c60d 2019-10-23 243: runshm: cleanvar
295630c60d 2019-10-23 244: echo "MRC:$@> Mount and populate /var/run/shm."; \
295630c60d 2019-10-23 245: mkdir -p /var/run/shm; \
295630c60d 2019-10-23 246: mount_tmpfs -m 01777 dummy /var/run/shm; \
295630c60d 2019-10-23 247: mkdir -p -m 01777 /var/run/shm/tmp; \
295630c60d 2019-10-23 248:
295630c60d 2019-10-23 249: savecore: dumpon
295630c60d 2019-10-23 250: .if empty(DUMPDEV:tl:Mno) && exists(${DUMPDEV}) && exists(${DUMPDIR})
295630c60d 2019-10-23 251: echo "MRC:$@> Saving coredump."; \
295630c60d 2019-10-23 252: savecore ${DUMPDIR} ${DUMPDEV}
295630c60d 2019-10-23 253: .if empty(CRASHINFO_ENABLE:tl:Mno)
295630c60d 2019-10-23 254: crashinfo -d ${DUMPDIR}
295630c60d 2019-10-23 255: .endif
295630c60d 2019-10-23 256: .endif
295630c60d 2019-10-23 257:
295630c60d 2019-10-23 258: swap: savecore
295630c60d 2019-10-23 259: .if ${:!sysctl -n vm.swap_enabled!}} != 0
295630c60d 2019-10-23 260: echo "MRC:$@> Enabling swap."; \
295630c60d 2019-10-23 261: swapon -a
295630c60d 2019-10-23 262: .endif
295630c60d 2019-10-23 263:
295630c60d 2019-10-23 264: sysctl: kld root
295630c60d 2019-10-23 265: .if exists(/etc/sysctl.conf)
295630c60d 2019-10-23 266: echo "MRC:$@> Setting sysctl defaults."; \
8f8bbe5cbb 2019-10-25 267: awk '$$0~/^[ ]*(#.*)?$$/{next}{print}' < /etc/sysctl.conf | \
8f8bbe5cbb 2019-10-25 268: xargs -n1 sysctl
295630c60d 2019-10-23 269: .endif
295630c60d 2019-10-23 270:
295630c60d 2019-10-23 271: sysdb: mountlate
295630c60d 2019-10-23 272: echo "MRC:$@> Building databases."; \
295630c60d 2019-10-23 273: install -c -m 644 -g wheel /dev/null /var/run/utmpx
295630c60d 2019-10-23 274:
295630c60d 2019-10-23 275: wlans: kld
295630c60d 2019-10-23 276: echo "MRC:$@> Configuring wlans."; \
8f8bbe5cbb 2019-10-25 277: for dev in $$(sysctl -n net.wlan.devices); do \
295630c60d 2019-10-23 278: eval all_wlans=\$${WLANS_$${dev}}; \
295630c60d 2019-10-23 279: for wlan in $${all_wlans}; do \
295630c60d 2019-10-23 280: eval wlan_args=\$${WLANS_$${wlan}_ARGS}; \
295630c60d 2019-10-23 281: ifconfig $${wlan} create wlandev $${dev} $${wlan_args}; \
295630c60d 2019-10-23 282: ifconfig $${wlan} up; \
295630c60d 2019-10-23 283: done; \
295630c60d 2019-10-23 284: done
cda92733d7 2019-10-25 285:
cda92733d7 2019-10-25 286: zfs:
cda92733d7 2019-10-25 287: .if empty(ZFS_ENABLE:tl:Mno)
cda92733d7 2019-10-25 288: zfs mount -va || exit $$? ;\
cda92733d7 2019-10-25 289: zfs share -a || exit $$? ;\
cda92733d7 2019-10-25 290: test -r /etc/zfs/exports || touch /etc/zfs/exports
cda92733d7 2019-10-25 291: .endif