Overview
| Comment: | Number of small changes: - fixed syntax a little; - ipv6 routing; - possible CPU microcode update bug; - cleaned up mounting FS RW; - changed how mixer works; - check errors on pf load; - change how wlans are created; - pock udevd to show socket and pid after FS mounts; - fix killing stopped service (I hope for the last time); - add delay and message on shutdown when something fails. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
f49abe7565d749513da1899025d9f638 |
| User & Date: | arcade on 2024-12-29 09:49:18.657 |
| Other Links: | manifest | tags |
Context
|
2024-12-31
| ||
| 17:14 | fix default sound source for mixer and missing socket for udevd check-in: 1c381d3eeb user: arcade tags: trunk | |
|
2024-12-29
| ||
| 09:49 | Number of small changes: - fixed syntax a little; - ipv6 routing; - possible CPU microcode update bug; - cleaned up mounting FS RW; - changed how mixer works; - check errors on pf load; - change how wlans are created; - pock udevd to show socket and pid after FS mounts; - fix killing stopped service (I hope for the last time); - add delay and message on shutdown when something fails. check-in: f49abe7565 user: arcade tags: trunk | |
|
2024-12-24
| ||
| 10:14 | Add README check-in: be69b48ea9 user: arcade tags: trunk | |
Changes
Modified defaults.mk
from [a86bad0d3a]
to [b5ec2c8f72].
| ︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # fsck FSCK_Y_ENABLE?=no # hostname HOSTNAME?=Amnesiac # kld KLD_LIST?= # ldconfig LDCONFIG_PATHS?=/lib /usr/lib /usr/local/lib /usr/pkg/lib LDCONFIG_LOCAL_DIRS?=/usr/local/libdata/ldconfig | > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# fsck
FSCK_Y_ENABLE?=no
# hostname
HOSTNAME?=Amnesiac
# HAS_INET6
HAS_INET6?=${:!sysctl -q net.inet6 >/dev/null && echo yes || echo no!}
PREFER?=IPV6 # or IPV4
# kld
KLD_LIST?=
# ldconfig
LDCONFIG_PATHS?=/lib /usr/lib /usr/local/lib /usr/pkg/lib
LDCONFIG_LOCAL_DIRS?=/usr/local/libdata/ldconfig
|
| ︙ | ︙ |
Modified init.mk
from [cd1516dace]
to [6667146e8d].
1 2 3 | # Meta targets TARGETS:=adjkerntz bootfs cleanvar cleartmp cloned devfs dmesg dumpon fsck \ | | | | | 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 ip6addrctl kld ldconfig microcode mixer mount mountlate \ mounttmpfs msgs netif newsyslog nextboot nfsclient pf pwcheck random root \ runshm savecore swap sysctl sysdb udevd_check utmpx 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 |
| ︙ | ︙ | |||
27 28 29 30 31 32 33 |
echo "MRC:$@> Checking whether we need /boot mounted."
mount -vadr | grep -q ' /boot$$' && mount -r /boot || true
cleanvar: mount
echo "MRC:$@> Cleaning '/var's."
.for dir in ${CLEANVAR_DIRS}
if [ -d ${dir} ]; then \
| | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
echo "MRC:$@> Checking whether we need /boot mounted."
mount -vadr | grep -q ' /boot$$' && mount -r /boot || true
cleanvar: mount
echo "MRC:$@> Cleaning '/var's."
.for dir in ${CLEANVAR_DIRS}
if [ -d ${dir} ]; then \
/rescue/find ${dir} -mindepth 1 -delete; \
fi
.endfor
cleartmp: mountlate
echo "MRC:$@> Clearing tmp."
find -x /tmp -mindepth 1 ! -name lost+found ! -name snapshots \
! -path "./snapshots/*" ! -name quota.user ! -name quota.group \
|
| ︙ | ︙ | |||
64 65 66 67 68 69 70 |
echo "MRC:$@> Writing dmesg."
( umask 022 ; dmesg -a > ${DMESG_FILE} ;)
.endif
dumpon: random
.if !empty(DUMPDEV)
if [ -e ${DUMPDEV} ]; then \
| | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
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}
ip6addrctl: root mount
.if empty(HAS_INET6:tl:Mno)
/usr/sbin/ip6addrctl flush >/dev/null 2>&1
. if !empty(PREFER:MIPV6)
echo "MRC:$@> Setting v4/v6 address selection defaults (prefer v6)."
printf "\
::1/128 50 0\n\
::/0 40 1\n\
::ffff:0:0/96 35 4\n\
2002::/16 30 2\n\
2001::/32 5 5\n\
fc00::/7 3 13\n\
::/96 1 3\n\
fec0::/10 1 11\n\
3ffe::/16 1 12\n" |\
/usr/sbin/ip6addrctl install /dev/stdin
. elif !empty(PREFER:MIPV4)
echo "MRC:$@> Setting v4/v6 address selection defaults (prefer v6)."
printf "\
::1/128 50 0\n\
::/0 40 1\n\
::ffff:0:0/96 100 4\n\
2002::/16 30 2\n\
2001::/32 5 5\n\
fc00::/7 3 13\n\
::/96 1 3\n\
fec0::/10 1 11\n\
3ffe::/16 1 12\n" |\
/usr/sbin/ip6addrctl install /dev/stdin
. else
echo "MRC:$@> Setting v4/v6 address selection defaults (none)."
. endif
.else
echo "MRC:$@> No INET6 support in kernel."
.endif
kld: bootfs
.if defined(KLD_LIST)
echo "MRC:$@> Loading kernel modules: ${KLD_LIST}"
. for KLD in ${KLD_LIST}
kldload -n ${KLD} || echo "MRC:$@> Failed to load module: ${KLD}"
. endfor
|
| ︙ | ︙ | |||
129 130 131 132 133 134 135 |
.for dir in ${LDCONFIG_LOCAL_DIRS}
.if exists(${dir})
ldc+=${:!find ${dir} -type f!}
.endif
.endfor
ldconfig: mountlate
| | | | | | | | | | | | | > > | | | | > | | | | | | | | | | | | | | | | | | < | | | | | | | | | > > > | | | | | | | | 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 280 281 282 283 284 285 286 287 288 289 290 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 |
.for dir in ${LDCONFIG_LOCAL_DIRS}
.if exists(${dir})
ldc+=${:!find ${dir} -type f!}
.endif
.endfor
ldconfig: mountlate
echo "MRC:$@> Initializing shared libraries: ${ldc}"
ldconfig -elf ${ldc}
microcode: mountlate
if [ -d /usr/local/share/cpucontrol ]; then \
echo "MRC:$@> Updating microcode."; \
if kldload -n cpuctl; then \
for cpu in $$(jot ${NCPU} 0); do \
cpucontrol -u /dev/cpuctl$${cpu}; \
done; \
for cpu in $$(jot ${NCPU} 1); do \
cpucontrol -e /dev/cpuctl$${cpu}; \
done \
else \
echo "MRC:$@> Failed to load [cpuctl]."; \
fi \
fi
mixer: mount cleanvar kld
echo "MRC:$@> Restoring levels."
for mixer in $$(find /dev -name 'mixer*' | sed 's|^/dev/||'); do \
if [ -r /var/db/$${mixer}-state ]; then \
mixer -f /dev/$${mixer} `cat /var/db/$${mixer}-state` || \
echo "MRC:$@> /dev/$${mixer} config load failed."; \
fi \
done
mixer_exit:
echo "MRC:$@> Saving mixer levels."
for mixer in $$(find /dev -name 'mixer*' | sed 's|^/dev/||'); do \
if [ -r /dev/$${mixer} ]; then \
mixer -f /dev/$${mixer} -s > /var/db/$${mixer}-state; \
fi \
done
DAEMON_EXIT: mixer_exit
excludes=${NETFS_TYPES:C/:.*//}
mount: root zfs
echo "MRC:$@> Mount local FS."
mount -p | awk '$$1~/^map$$/{next}$$3!~/^(tmpfs|null|procfs)$$/{print"mount -uo rw "$$1}' | sh
mount
mount -a -t no${excludes:ts,}
mountlate: NETWORK mount cleanvar runshm devd mounttmpfs
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 cloned ip6addrctl kld mounttmpfs utmpx wlans
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."
if kldload -n pf; then \
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 \
else \
echo "MRC:$@> Failed to load [pf]."; \
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 2>/dev/null
dd if=/bin/ps status=none of=/dev/random bs=8k 2>/dev/null
if [ -d $${ENTROPY_DIR} ]; then \
find $${ENTROPY_DIR} -type f | \
xargs -n1 -Ifoo dd status=none if=foo of=/dev/random bs=8k 2>/dev/null; \
else \
if [ -r ${ENTROPY_FILE} ]; then \
dd status=none if=${ENTROPY_FILE} of=/dev/random bs=8k 2>/dev/null; \
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 2>/dev/null || \
echo "MRC:$@> entropy file write failed."; \
)
DAEMON_EXIT: random_exit
root: fsck bootfs
echo "MRC:$@> Mount root R/W."
mount -uo rw
|
| ︙ | ︙ | |||
297 298 299 300 301 302 303 | .endif sysdb: mountlate echo "MRC:$@> Building databases." install -c -m 644 -g wheel /dev/null /var/run/utmpx wlans: kld | | | > | | > | > > > | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
.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} && \
{ \
ifconfig $${wlan} $${wlan_args}; \
ifconfig $${wlan} up; \
}; \
} || echo "MRC:$@> ERROR: WLAN $${wlan} failed to initialize."; \
done \
done
zfs:
.if empty(ZFS_ENABLE:tl:Mno)
zfs mount -va || exit $$?
zfs share -a || exit $$?
|
| ︙ | ︙ | |||
328 329 330 331 332 333 334 | mount_tmpfs -m 01777 dummy /var/run/shm . endif mtree -deiqU -f /etc/mtree/BSD.var.dist -p /var mounttmpfs: cleanvar echo "MRC:$@> Mount tmpfs and populating /var/run." .if exists(TMPFS_TMP_ENABLE) | | | | > > > > > > > > > > > > | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
mount_tmpfs -m 01777 dummy /var/run/shm
. endif
mtree -deiqU -f /etc/mtree/BSD.var.dist -p /var
mounttmpfs: cleanvar
echo "MRC:$@> Mount tmpfs and populating /var/run."
.if exists(TMPFS_TMP_ENABLE)
mount | awk 'BEGIN{x=1}$$3~/\/tmp/{x=0}END{exit(x)}' || { \
/rescue/find /tmp -mindepth 1 -delete; \
mount_tmpfs -m 01777 dummy /tmp; \
}
.endif
udevd_check: DAEMON
echo "MRC:$@> Check udevd PID/socket are accessible."
if [ ! -e /var/run/udevd.pid ]; then \
pkill -HUP -x udevd; \
( \
sleep 1; \
if [ ! -e /var/run/udevd.pid ]; then \
svc restart udevd; \
fi \
) & \
fi
utmpx: runshm
echo "MRC:$@> Install utmpx."
install -m 644 -g wheel /dev/null /var/run/utmpx
|
Modified rc.shutdown
from [367b06024b]
to [dc824dad4c].
| ︙ | ︙ | |||
9 10 11 12 13 14 15 | export PATH HOME MAKEINIT="make -D AUTOBOOT -C /etc/mrc -k" NCPU=$((`/sbin/sysctl -n hw.ncpu` + 1 )) #MAKEDEBUG="-d -nelLx" | | > | 9 10 11 12 13 14 15 16 17 18 19 20 |
export PATH HOME
MAKEINIT="make -D AUTOBOOT -C /etc/mrc -k"
NCPU=$((`/sbin/sysctl -n hw.ncpu` + 1 ))
#MAKEDEBUG="-d -nelLx"
mount -t tmpfs tmpfs /etc/mrc/tmp && ${MAKEINIT} -j ${NCPU} ${MAKEDEBUG} -X TMPDIR=/etc/mrc/tmp EXIT && umount /etc/mrc/tmp ||\
{ echo EXIT failed repeating nonparallel in 10 seconds ; sleep 10 ; ${MAKEINIT} EXIT ; }
echo '.'
exit 0
|
Modified svc.starter.mk
from [d1d5a830d6]
to [c877a9b183].
1 2 3 4 5 6 7 8 9 |
_service_svc: .USE
cd ${DAEMON_$@_CWD} ;\
svc list $@ | grep -q $@ || \
svc -u ${DAEMON_$@_USER} -g ${DAEMON_$@_GROUP} ${DAEMON_$@_RESTART:D-r} ${DAEMON_$@_RESTART} init $@ $${CMD} ${DAEMON_$@_FLAGS} ${DAEMON_$@_FOREGROUND}
_service_svc_status: .USE
svc status ${@:S/_status//}
_service_svc_exit: .USEBEFORE
| | > | 1 2 3 4 5 6 7 8 9 10 11 12 |
_service_svc: .USE
cd ${DAEMON_$@_CWD} ;\
svc list $@ | grep -q $@ || \
svc -u ${DAEMON_$@_USER} -g ${DAEMON_$@_GROUP} ${DAEMON_$@_RESTART:D-r} ${DAEMON_$@_RESTART} init $@ $${CMD} ${DAEMON_$@_FLAGS} ${DAEMON_$@_FOREGROUND}
_service_svc_status: .USE
svc status ${@:S/_status//}
_service_svc_exit: .USEBEFORE
#svc list ${@:S/_exit//} | grep -q ${@:S/_exit//} || true &&
lockf -kst 0 /var/run/service.${@:S/_exit//}.pid svc -t 0 kill ${@:S/_exit//} || \
svc -s exit ${@:S/_exit//}
|