. /etc/default/rcS
export VERBOSE
+startup_progress() {
+ step=$(($step + $step_change))
+ progress=$(($step * $progress_size / $num_steps + $first_step))
+ if type psplash-write >/dev/null 2>&1; then
+ TMPDIR=/mnt/.psplash psplash-write "PROGRESS $progress" || true
+ fi
+}
+
+
#
# Start script or program.
#
startup() {
+ # Handle verbosity
+ [ "$VERBOSE" = very ] && echo "INIT: Running $@..."
+
case "$1" in
*.sh)
- sh "$@"
+ # Source shell script for speed.
+ (
+ trap - INT QUIT TSTP
+ scriptname=$1
+ shift
+ . $scriptname
+ )
;;
*)
"$@"
;;
esac
+ startup_progress
}
# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
# Is there an rc directory for this new runlevel?
if [ -d /etc/rc$runlevel.d ]
then
+ # Find out where in the progress bar the initramfs got to.
+ PROGRESS_STATE=0
+ #if [ -f /dev/.initramfs/progress_state ]; then
+ # . /dev/.initramfs/progress_state
+ #fi
+
+ # Split the remaining portion of the progress bar into thirds
+ progress_size=$(((100 - $PROGRESS_STATE) / 3))
+
+ case "$runlevel" in
+ 0|6)
+ # Count down from 0 to -100 and use the entire bar
+ first_step=0
+ progress_size=100
+ step_change=-1
+ ;;
+ S)
+ # Begin where the initramfs left off and use 2/3
+ # of the remaining space
+ first_step=$PROGRESS_STATE
+ progress_size=$(($progress_size * 2))
+ step_change=1
+ ;;
+ *)
+ # Begin where rcS left off and use the final 1/3 of
+ # the space (by leaving progress_size unchanged)
+ first_step=$(($progress_size * 2 + $PROGRESS_STATE))
+ step_change=1
+ ;;
+ esac
+
# First, run the KILL scripts.
if [ $previous != N ]
then
startup $i stop
done
fi
+
+ num_steps=0
+ for s in /etc/rc$runlevel.d/[SK]*; do
+ case "${s##/etc/rc$runlevel.d/S??}" in
+ gdm|xdm|kdm|reboot|halt)
+ break
+ ;;
+ esac
+ num_steps=$(($num_steps + 1))
+ done
+
+ step=0
+
# Now run the START scripts for this runlevel.
for i in /etc/rc$runlevel.d/S*
do
esac
done
fi
-# eof /etc/init.d/rc
+
+if [ "x$runlevel" != "xS" ]; then
+ if type psplash-write >/dev/null 2>&1; then
+ TMPDIR=/mnt/.psplash psplash-write "QUIT" || true
+ umount /mnt/.psplash
+ fi
+fi
trap ":" INT QUIT TSTP
#
-# Do we have /proc/progress and set VERBOSE to "no" ?
-# If so, calculate the number of scripts and the incremental step
-#
-if [ "$VERBOSE" = no ]; then
- if [ -e /proc/progress ]; then
- set `ls -1 /etc/rc$runlevel.d/S* | wc`
- numscripts=$1
- PROGRESS_incstep=`expr 90 / $1`
- PROGRESS_value=10
- PROGRESS=yes
- export PROGRESS_value PROGRESS_incstep
- fi
-fi
-export VERBOSE PROGRESS
-
-#
# Call all parts in order.
#
-for i in /etc/rcS.d/S??*
-do
- # Ignore dangling symlinks for now.
- [ ! -f "$i" ] && continue
-
- # Handle verbosity
- [ "$VERBOSE" = very ] && echo "INIT: Running $i..."
- if [ "$PROGRESS" = yes ]; then
- export PROGRESS_value=`expr $PROGRESS_value + $PROGRESS_incstep`
- echo "$PROGRESS_value Starting $i..." >/proc/progress
- fi
-
- case "$i" in
- *.sh)
- # Source shell script for speed.
- (
- trap - INT QUIT TSTP
- set start
- . $i
- )
- ;;
- *)
- # No sh extension, so fork subprocess.
- $i start
- ;;
- esac
-
- #
- # Report status based on result code
- #
- result=$?
- if [ "$PROGRESS" = yes ]; then
- if [ "$result" = 0 ]; then
- echo "=s" >/proc/progress
- else
- echo "=f" >/proc/progress
- fi
- fi
-done
+exec /etc/init.d/rc S
#
# For compatibility, run the files in /etc/rc.boot too.