Annotation For init.mk
Logged in as anonymous

Lines of init.mk from check-in 8f8bbe5cbb that are changed by the sequence of edits moving toward check-in 35e11e77a2:

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