Browse Source

We want to run sysmerge(8) a bit earlier in the boot process so that it has a

chance to update the *default* configuration of the important daemons.
Factorize rc.firsttime into a run_upgrade_script() function which takes the
script suffix name as an argument.
i.e. run_upgrade_script sysmerge / run_upgrade_script firsttime
discussed with deraadt@
ok deraadt@ rpe@
OPENBSD_6_0
ajacoutot 8 years ago
parent
commit
feb88d7f69
1 changed files with 16 additions and 7 deletions
  1. +16
    -7
      src/etc/rc

+ 16
- 7
src/etc/rc View File

@ -1,4 +1,4 @@
# $OpenBSD: rc,v 1.476 2016/04/27 09:17:53 rpe Exp $
# $OpenBSD: rc,v 1.477 2016/04/27 14:49:11 ajacoutot 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
@ -187,6 +187,17 @@ rebuildlibs() {
done
}
run_upgrade_script() {
local _suffix=$1
[[ -n $_suffix ]] || return 1
if [[ -f /etc/rc.$_suffix ]]; then
mv /etc/rc.$_suffix /etc/rc.$_suffix.run
. /etc/rc.$_suffix.run 2>&1 | tee /dev/tty |
mail -Es "$(hostname) rc.$_suffix output" root >/dev/null
fi
rm -f /etc/rc.$_suffix.run
}
# Check filesystems, optionally by using a fsck(8) flag.
# Usage: do_fsck [-flag]
do_fsck() {
@ -476,6 +487,9 @@ fi
echo 'preserving editor files.'; /usr/libexec/vi.recover
# If rc.sysmerge exists, run it just once, and make sure it is deleted.
run_upgrade_script sysmerge
echo -n 'starting network daemons:'
start_daemon ldomd vmd sshd snmpd ldpd ripd ospfd ospf6d bgpd ifstated
start_daemon relayd dhcpd dhcrelay mrouted dvmrpd radiusd eigrpd
@ -492,12 +506,7 @@ start_daemon rbootd mopd spamd spamlogd sndiod
echo '.'
# If rc.firsttime exists, run it just once, and make sure it is deleted.
if [[ -f /etc/rc.firsttime ]]; then
mv /etc/rc.firsttime /etc/rc.firsttime.run
. /etc/rc.firsttime.run 2>&1 | tee /dev/tty |
mail -Es "$(hostname) rc.firsttime output" root >/dev/null
fi
rm -f /etc/rc.firsttime.run
run_upgrade_script firsttime
# Run rc.d(8) scripts from packages.
if [[ -n $pkg_scripts ]]; then


Loading…
Cancel
Save