diff options
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc | 3 | ||||
-rw-r--r-- | etc/rc.d/rc.subr | 56 | ||||
-rw-r--r-- | etc/rc.local | 4 | ||||
-rw-r--r-- | etc/rc.shutdown | 4 |
4 files changed, 46 insertions, 21 deletions
@@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.348 2011/01/14 00:05:42 deraadt Exp $ +# $OpenBSD: rc,v 1.349 2011/03/17 16:43:51 robert Exp $ # System startup script run by init on autoboot # or after single-user. @@ -152,6 +152,7 @@ trap : 2 trap : 3 # shouldn't be needed HOME=/; export HOME +INRC=1; export INRC PATH=/sbin:/bin:/usr/sbin:/usr/bin export PATH diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr index 03a0e977ced..bdbaace41bc 100644 --- a/etc/rc.d/rc.subr +++ b/etc/rc.d/rc.subr @@ -1,4 +1,4 @@ -# $OpenBSD: rc.subr,v 1.26 2011/03/14 11:28:44 ajacoutot Exp $ +# $OpenBSD: rc.subr,v 1.27 2011/03/17 16:43:51 robert Exp $ # Default functions and variables used by rc.d(8) scripts. @@ -23,6 +23,30 @@ rc_stop() { pkill -f "^${pexp}" } +rc_do() { + if [ X"${RC_DEBUG}" = X"1" ]; then + echo "doing $@" && "$@" + else + "$@" >/dev/null 2>&1 + fi +} + +rc_print() { + _ret=$? + echo ${INRC:+'-n'} "${INRC:+ }${_name}($1)" + return ${_ret} +} + +rc_wait() { + i=0 + while [ $i -lt 5 ]; do + rc_do rc_check || return 0 + sleep 1 + i=$((i+1)) + done + return 1 +} + rc_cmd() { [ $(id -u) -eq 0 -o X"$1" = "Xcheck" ] || \ rc_err "$0: need root privileges" @@ -34,36 +58,36 @@ rc_cmd() { case "$1" in check) - rc_check >/dev/null + rc_do rc_check ;; start) - rc_check || \ + rc_do rc_check || \ ( if type rc_pre >/dev/null; then - rc_pre + rc_do rc_pre fi - [ $? -eq 0 ] && rc_start >/dev/null + [ $? -eq 0 ] && \ + rc_do rc_start && \ + rc_print ok || rc_print failed ) ;; stop) - if rc_check; then rc_stop >/dev/null && \ + if rc_do rc_check; then rc_do rc_stop || \ + ( rc_print failed ) && \ ( - i=0 - while [ $i -lt 5 ]; do - rc_check || break - sleep 1 - i=$((i+1)) - done - if [ $i -lt 5 ]; then + rc_do rc_wait && + ( if type rc_post >/dev/null; then \ - rc_post + rc_do rc_post fi - fi + ) && rc_print ok || rc_print failed ) + else + return 0 fi ;; reload) - rc_check && rc_reload >/dev/null + rc_do rc_check && rc_do rc_reload ;; restart) /etc/rc.d/${_name} stop && /etc/rc.d/${_name} start diff --git a/etc/rc.local b/etc/rc.local index a4242ef776d..27bcec0d575 100644 --- a/etc/rc.local +++ b/etc/rc.local @@ -1,4 +1,4 @@ -# $OpenBSD: rc.local,v 1.41 2010/11/05 10:03:00 ajacoutot Exp $ +# $OpenBSD: rc.local,v 1.42 2011/03/17 16:43:51 robert Exp $ # Site-specific startup actions, daemons, and other things which # can be done AFTER your system goes into securemode. For actions @@ -8,7 +8,7 @@ echo -n 'starting local daemons:' for _r in $rc_scripts; do - [ -x /etc/rc.d/${_r} ] && echo -n " ${_r}" && /etc/rc.d/${_r} start + [ -x /etc/rc.d/${_r} ] && /etc/rc.d/${_r} start done # Add your local startup actions here. diff --git a/etc/rc.shutdown b/etc/rc.shutdown index ca205be85e8..2031f69483f 100644 --- a/etc/rc.shutdown +++ b/etc/rc.shutdown @@ -1,4 +1,4 @@ -# $OpenBSD: rc.shutdown,v 1.10 2010/11/26 08:09:35 ajacoutot Exp $ +# $OpenBSD: rc.shutdown,v 1.11 2011/03/17 16:43:51 robert Exp $ # # If it exists, this script is run at system-shutdown by reboot(8), # halt(8). If the architecture supports keyboard requested halting, @@ -12,7 +12,7 @@ echo -n 'stopping local daemons:' while [ -n "${rc_scripts}" ]; do _r=${rc_scripts##* } rc_scripts=${rc_scripts%%*( )${_r}} - [ -x /etc/rc.d/${_r} ] && echo -n " ${_r}" && /etc/rc.d/${_r} stop + [ -x /etc/rc.d/${_r} ] && /etc/rc.d/${_r} stop done # Add your local shutdown actions here. |