sysvinit: Add psplash support, remove elpp support, convert rcS to use rc, speedup...
authorRichard Purdie <richard@openedhand.com>
Thu, 28 Sep 2006 14:21:06 +0000 (14:21 +0000)
committerRichard Purdie <richard@openedhand.com>
Thu, 28 Sep 2006 14:21:06 +0000 (14:21 +0000)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@771 311d38ba-8fff-0310-9ca6-ca027cbcb966

meta/packages/sysvinit/sysvinit/rc
meta/packages/sysvinit/sysvinit/rcS
meta/packages/sysvinit/sysvinit_2.86.bb

index fdb0fce..a355ea0 100755 (executable)
 . /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.
@@ -56,6 +75,37 @@ startup() {
   # 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
@@ -68,6 +118,19 @@ startup() {
                        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
@@ -99,4 +162,10 @@ startup() {
                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
index e7a7e61..90af414 100755 (executable)
@@ -36,63 +36,9 @@ 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.
index 72ce082..4ea1e4d 100644 (file)
@@ -2,7 +2,7 @@ DESCRIPTION = "System-V like init."
 SECTION = "base"
 LICENSE = "GPL"
 HOMEPAGE = "http://freshmeat.net/projects/sysvinit/"
-PR = "r24"
+PR = "r26"
 
 # USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf.
 # Set PACKAGE_ARCH appropriately.