=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/etc/rc,v retrieving revision 1.494 retrieving revision 1.495 diff -c -r1.494 -r1.495 *** src/etc/rc 2017/04/18 23:06:50 1.494 --- src/etc/rc 2017/05/01 14:01:47 1.495 *************** *** 1,4 **** ! # $OpenBSD: rc,v 1.494 2017/04/18 23:06:50 schwarze Exp $ # System startup script run by init on autoboot or after single-user. # Output and error are redirected to console by init, and the console is the --- 1,4 ---- ! # $OpenBSD: rc,v 1.495 2017/05/01 14:01:47 rpe Exp $ # System startup script run by init on autoboot or after single-user. # Output and error are redirected to console by init, and the console is the *************** *** 9,15 **** # Subroutines (have to come first). - # Strip in- and whole-line comments from a file. # Strip leading and trailing whitespace if IFS is set. # Usage: stripcom /path/to/file --- 9,14 ---- *************** *** 81,93 **** done } random_seed() { - # push the old seed into the kernel dd if=/var/db/host.random of=/dev/random bs=65536 count=1 status=none chmod 600 /var/db/host.random - # ... and create a future seed dd if=/dev/random of=/var/db/host.random bs=65536 count=1 status=none - # and create a seed file for the boot-loader dd if=/dev/random of=/etc/random.seed bs=512 count=1 status=none chmod 600 /etc/random.seed } --- 80,91 ---- done } + # Push the old seed into the kernel, create a future seed and create a seed + # file for the boot-loader. random_seed() { dd if=/var/db/host.random of=/dev/random bs=65536 count=1 status=none chmod 600 /var/db/host.random dd if=/dev/random of=/var/db/host.random bs=65536 count=1 status=none dd if=/dev/random of=/etc/random.seed bs=512 count=1 status=none chmod 600 /etc/random.seed } *************** *** 277,288 **** domainname "$(stripcom /etc/defaultdomain)" fi ! # Need to get local functions from rc.subr. FUNCS_ONLY=1 . /etc/rc.d/rc.subr - - # Load rc.conf into scope. _rc_parse_conf if [[ $1 == shutdown ]]; then if echo 2>/dev/null >>/var/db/host.random || \ echo 2>/dev/null >>/etc/random.seed; then --- 275,288 ---- domainname "$(stripcom /etc/defaultdomain)" fi ! # Get local functions from rc.subr to load rc.conf into scope. FUNCS_ONLY=1 . /etc/rc.d/rc.subr _rc_parse_conf + # If executed with the 'shutdown' parameter by the halt, reboot or shutdown: + # - update seed files + # - execute the rc.d scripts specified by $pkg_scripts in reverse order + # - bring carp interfaces down gracefully if [[ $1 == shutdown ]]; then if echo 2>/dev/null >>/var/db/host.random || \ echo 2>/dev/null >>/etc/random.seed; then *************** *** 309,315 **** [[ -f /etc/rc.shutdown ]] && sh /etc/rc.shutdown fi - # Bring carp interfaces down gracefully. ifconfig | while read _if _junk; do [[ $_if == carp+([0-9]): ]] && ifconfig ${_if%:} down done --- 309,314 ---- *************** *** 320,325 **** --- 319,325 ---- # Add swap block-devices. swapctl -A -t blk + # Run filesystem check unless a /fastboot file exists. if [[ -e /fastboot ]]; then echo "Fast boot: skipping disk checks." elif [[ $1 == autoboot ]]; then *************** *** 327,340 **** do_fsck fi trap "echo 'Boot interrupted.'; exit 1" 3 umount -a >/dev/null 2>&1 mount -a -t nonfs,vnd - mount -uw / # root on nfs requires this, others aren't hurt. - rm -f /fastboot # XXX (root now writeable) ! # Set flags on ttys. (Do early, in case they use tty for SLIP in netstart.) echo 'setting tty flags' ttyflags -a --- 327,348 ---- do_fsck fi + # From now on, allow user to interrupt (^C) the boot process. trap "echo 'Boot interrupted.'; exit 1" 3 + # Unmount all filesystems except root. umount -a >/dev/null 2>&1 + + # Mount all filesystems except those of type NFS and VND. mount -a -t nonfs,vnd ! # Re-mount the root filesystem read/writeable. (root on nfs requires this, ! # others aren't hurt.) ! mount -uw / ! ! rm -f /fastboot ! ! # Set flags on ttys. (Do early, in case they use tty for SLIP in netstart.) echo 'setting tty flags' ttyflags -a *************** *** 374,380 **** pfctl -e fi - # Fill net.inet.(tcp|udp).baddynamic lists from /etc/services. fill_baddynamic udp fill_baddynamic tcp --- 382,387 ---- *************** *** 394,400 **** sh /etc/netstart ! dmesg >/dev/random # Any write triggers a rekey. # Load pf rules and bring up pfsync interface. if [[ $pf != NO ]]; then --- 401,408 ---- sh /etc/netstart ! # Any write triggers a rekey. ! dmesg >/dev/random # Load pf rules and bring up pfsync interface. if [[ $pf != NO ]]; then *************** *** 418,424 **** (cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; }) (cd /var/authpf && rm -rf -- *) ! dmesg >/var/run/dmesg.boot # Save a copy of the boot messages. make_keys --- 426,433 ---- (cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; }) (cd /var/authpf && rm -rf -- *) ! # Save a copy of the boot messages. ! dmesg >/var/run/dmesg.boot make_keys *************** *** 473,479 **** chmod 666 /dev/tty[pqrstuvwxyzPQRST]* chown root:wheel /dev/tty[pqrstuvwxyzPQRST]* ! # Check the password temp/lock file. if [[ -f /etc/ptmp ]]; then logger -s -p auth.err \ 'password file may be incorrect -- /etc/ptmp exists' --- 482,488 ---- chmod 666 /dev/tty[pqrstuvwxyzPQRST]* chown root:wheel /dev/tty[pqrstuvwxyzPQRST]* ! # Check for the password temp/lock file. if [[ -f /etc/ptmp ]]; then logger -s -p auth.err \ 'password file may be incorrect -- /etc/ptmp exists' *************** *** 560,566 **** [[ -f /etc/rc.local ]] && sh /etc/rc.local ! ifconfig -g carp -carpdemote 128 # Disable carp interlock. mixerctl_conf --- 569,576 ---- [[ -f /etc/rc.local ]] && sh /etc/rc.local ! # Disable carp interlock. ! ifconfig -g carp -carpdemote 128 mixerctl_conf