From 9af04a7b4b005dbf86f38e9fc157bd3b505315a4 Mon Sep 17 00:00:00 2001 From: ajacoutot <> Date: Fri, 22 Apr 2011 06:08:14 +0000 Subject: [PATCH] Move the rc.d(8) bits from rc.{local,shutdown} directly into /etc/rc. By default, rc.{local,shutdown} don't output anything anymore. original idea from schwarze@ discussed with deraadt@ and no objection from millert@ ok schwarze@ robert@ --- src/etc/rc | 23 +++++++++++++++++++++-- src/etc/rc.local | 14 +------------- src/etc/rc.shutdown | 12 +----------- 3 files changed, 23 insertions(+), 26 deletions(-) diff --git a/src/etc/rc b/src/etc/rc index a3d9ea11..1f7209f5 100644 --- a/src/etc/rc +++ b/src/etc/rc @@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.351 2011/04/16 05:53:18 ajacoutot Exp $ +# $OpenBSD: rc,v 1.352 2011/04/22 06:08:14 ajacoutot Exp $ # System startup script run by init on autoboot # or after single-user. @@ -162,7 +162,17 @@ export PATH if [ X"$1" = X"shutdown" ]; then dd if=/dev/arandom of=/var/db/host.random bs=65536 count=1 >/dev/null 2>&1 chmod 600 /var/db/host.random >/dev/null 2>&1 - if [ $? -eq 0 -a -f /etc/rc.shutdown ]; then + local _c=$? + if [ ${_c} -eq 0 -a -n "${rc_scripts}" ]; then + echo -n 'stopping package daemons:' + while [ -n "${rc_scripts}" ]; do + _r=${rc_scripts##* } + rc_scripts=${rc_scripts%%*( )${_r}} + [ -x /etc/rc.d/${_r} ] && /etc/rc.d/${_r} stop + done + echo '.' + fi + if [ ${_c} -eq 0 -a -f /etc/rc.shutdown ]; then echo /etc/rc.shutdown in progress... . /etc/rc.shutdown echo /etc/rc.shutdown complete. @@ -798,6 +808,15 @@ if [ -f /etc/rc.firsttime ]; then fi rm -f /etc/rc.firsttime.run +# Run rc.d(8) scripts from packages +if [ -n "${rc_scripts}" ]; then + echo -n 'starting package daemons:' + for _r in $rc_scripts; do + [ -x /etc/rc.d/${_r} ] && /etc/rc.d/${_r} start + done + echo '.' +fi + [ -f /etc/rc.local ] && . /etc/rc.local echo -n starting standard daemons: diff --git a/src/etc/rc.local b/src/etc/rc.local index 8f13b513..944b7b4e 100644 --- a/src/etc/rc.local +++ b/src/etc/rc.local @@ -1,18 +1,6 @@ -# $OpenBSD: rc.local,v 1.43 2011/04/18 18:08:20 robert Exp $ +# $OpenBSD: rc.local,v 1.44 2011/04/22 06:08:14 ajacoutot Exp $ # Site-specific startup actions, daemons, and other things which # can be done AFTER your system goes into securemode. For actions # which should be done BEFORE your system has gone into securemode # please see /etc/rc.securelevel. - -if [ -n "${rc_scripts}" ]; then - echo -n 'starting local daemons:' - - for _r in $rc_scripts; do - [ -x /etc/rc.d/${_r} ] && /etc/rc.d/${_r} start - done - - echo '.' -fi - -# Add your local startup actions here. diff --git a/src/etc/rc.shutdown b/src/etc/rc.shutdown index 2031f694..9976eb04 100644 --- a/src/etc/rc.shutdown +++ b/src/etc/rc.shutdown @@ -1,4 +1,4 @@ -# $OpenBSD: rc.shutdown,v 1.11 2011/03/17 16:43:51 robert Exp $ +# $OpenBSD: rc.shutdown,v 1.12 2011/04/22 06:08:14 ajacoutot Exp $ # # If it exists, this script is run at system-shutdown by reboot(8), # halt(8). If the architecture supports keyboard requested halting, @@ -7,14 +7,4 @@ powerdown=NO # set to YES for powerdown -echo -n 'stopping local daemons:' - -while [ -n "${rc_scripts}" ]; do - _r=${rc_scripts##* } - rc_scripts=${rc_scripts%%*( )${_r}} - [ -x /etc/rc.d/${_r} ] && /etc/rc.d/${_r} stop -done - # Add your local shutdown actions here. - -echo '.'