From ab772a24e503cbfa7f7d72185ae0b86a64844e89 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 27 Dec 2013 22:15:40 +0000 Subject: [PATCH] re-do shutdown operations. Run the scripts if we may; take down carp unconditionally, and then do the optional powerdown discussed at length with rpe --- etc/rc | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/etc/rc b/etc/rc index f136d4d5267..961052b6d55 100644 --- a/etc/rc +++ b/etc/rc @@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.412 2013/12/27 04:21:48 deraadt Exp $ +# $OpenBSD: rc,v 1.413 2013/12/27 22:15:40 deraadt Exp $ # System startup script run by init on autoboot # or after single-user. @@ -233,33 +233,33 @@ if [ X"$1" = X"shutdown" ]; then dd if=/dev/random of=/var/db/host.random bs=65536 count=1 >/dev/null 2>&1 chmod 600 /var/db/host.random >/dev/null 2>&1 _c=$? - if [ ${_c} -eq 0 -a -n "${pkg_scripts}" ]; then - echo -n 'stopping package daemons:' - while [ -n "${pkg_scripts}" ]; do - _r=${pkg_scripts##* } - pkg_scripts=${pkg_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 + if [ ${_c} -eq 0 ]; then + if [ -n "${pkg_scripts}" ]; then + echo -n 'stopping package daemons:' + while [ -n "${pkg_scripts}" ]; do + _r=${pkg_scripts##* } + pkg_scripts=${pkg_scripts%%*( )${_r}} + [ -x /etc/rc.d/${_r} ] && /etc/rc.d/${_r} stop + done + echo '.' + fi + echo /etc/rc.shutdown in progress... . /etc/rc.shutdown echo /etc/rc.shutdown complete. + else + echo single user: not running shutdown scripts + fi - # bring carp interfaces down gracefully - ifconfig | while read a b; do - case $a in - carp+([0-9]):) ifconfig ${a%:} down ;; - esac - done - - if [ X"${powerdown}" = X"YES" ]; then - exit 2 - fi + # bring carp interfaces down gracefully + ifconfig | while read a b; do + case $a in + carp+([0-9]):) ifconfig ${a%:} down ;; + esac + done - else - echo single user: not running /etc/rc.shutdown + if [ X"${powerdown}" = X"YES" ]; then + exit 2 fi exit 0 fi -- 2.20.1