diff options
author | Robert Peichaer <rpe@cvs.openbsd.org> | 2017-08-20 19:45:38 +0000 |
---|---|---|
committer | Robert Peichaer <rpe@cvs.openbsd.org> | 2017-08-20 19:45:38 +0000 |
commit | 3cce3c2db2eddd4482b8e7ee794658831f4daa90 (patch) | |
tree | 516b9a443e42a18d098499666bc9289bf3344c2a /etc | |
parent | 526018f030baea0992a0ca54257883f19e5cb8d7 (diff) |
Simplify the code for stopping daemons listed in pkg_scripts in
reverse order on shutdown.
OK aja@ tb@
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.513 2017/07/18 19:31:20 zhuk Exp $ +# $OpenBSD: rc,v 1.514 2017/08/20 19:45:37 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 @@ -337,13 +337,13 @@ if [[ $1 == shutdown ]]; then if (($(sysctl -n kern.securelevel) == 0)); then echo 'single user: not running shutdown scripts' else - pkg_scripts=${pkg_scripts%%*( )} - if [[ -n $pkg_scripts ]]; then + set -A _d -- $pkg_scripts + _i=${#_d[*]} + if ((_i)); then echo -n 'stopping package daemons:' - while [[ -n $pkg_scripts ]]; do - _d=${pkg_scripts##* } - pkg_scripts=${pkg_scripts%%*( )$_d} - [[ -x /etc/rc.d/$_d ]] && /etc/rc.d/$_d stop + while ((--_i >= 0)); do + [[ -x /etc/rc.d/${_d[_i]} ]] && + /etc/rc.d/${_d[_i]} stop done echo '.' fi |