Annotation For init.mk
Logged in as anonymous

Lines of init.mk from check-in d332ed9f4a that are changed by the sequence of edits moving toward check-in d8511a3d7c:

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