diff options
Diffstat (limited to 'src.etc/init.d/rc')
-rwxr-xr-x | src.etc/init.d/rc | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/src.etc/init.d/rc b/src.etc/init.d/rc index 0db7c8d..e6985dd 100755 --- a/src.etc/init.d/rc +++ b/src.etc/init.d/rc @@ -3,11 +3,33 @@ # /etc/init.d/rc # Executes init scripts on init and shutdown. # -# Copyright (C) 2012 Patrick "P. J." McDermott +# Copyright (C) 2012, 2014 Patrick "P. J." McDermott +# # This file may be reproduced, distributed, modified, and otherwise dealt in -# under the terms of the Expat/MIT License. +# under the terms of the Expat License. + +LF=' +' + +[ -x /usr/bin/logger ] && logger='logger -p 6 -t sysinit' || logger=cat + +# Buffer log lines until syslogd is running. +log() +{ + local line= + local buf= -[ -x /usr/bin/logger ] && logger='logger -s -p 6 -t sysinit' || logger=cat + while read -r line; do + buf="${buf}${line}${LF}" + if [ -f /var/run/syslogd.pid ]; then + printf '%s' "${buf}" | ${logger} + exec ${logger} + fi + done + if [ -f /var/run/syslogd.pid ]; then + printf '%s' "${buf}" | ${logger} + fi +} level=${0#*/rc} case ${level} in @@ -22,6 +44,11 @@ case ${level} in ;; esac -for i in /etc/rc.d/${level}*; do - [ -x "${i}" ] && "${i}" ${action} 2>&1 -done | ${logger} +{ + for i in /etc/rc.d/${level}[0-1]*; do + [ -x "${i}" ] && "${i}" ${action} 2>&1 + done + for i in /etc/rc.d/${level}[2-9]*; do + [ -x "${i}" ] && "${i}" ${action} 2>&1 + done +} | log |