summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-09-28 14:21:06 +0000
committerRichard Purdie <richard@openedhand.com>2006-09-28 14:21:06 +0000
commiteb83f4bb4e05b8a8c12340be1e1d03d136cb6811 (patch)
treee74897973e410d3648ef5fe8eb433048104e007d
parentb462c8bee52fafc1eade2d913d3a50dc301a3fdf (diff)
downloadpoky-eb83f4bb4e05b8a8c12340be1e1d03d136cb6811.tar.gz
sysvinit: Add psplash support, remove elpp support, convert rcS to use rc, speedup execution of sh scripts
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@771 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rwxr-xr-xmeta/packages/sysvinit/sysvinit/rc73
-rwxr-xr-xmeta/packages/sysvinit/sysvinit/rcS56
-rw-r--r--meta/packages/sysvinit/sysvinit_2.86.bb2
3 files changed, 73 insertions, 58 deletions
diff --git a/meta/packages/sysvinit/sysvinit/rc b/meta/packages/sysvinit/sysvinit/rc
index fdb0fce887..a355ea05cc 100755
--- a/meta/packages/sysvinit/sysvinit/rc
+++ b/meta/packages/sysvinit/sysvinit/rc
@@ -18,18 +18,37 @@
18. /etc/default/rcS 18. /etc/default/rcS
19export VERBOSE 19export VERBOSE
20 20
21startup_progress() {
22 step=$(($step + $step_change))
23 progress=$(($step * $progress_size / $num_steps + $first_step))
24 if type psplash-write >/dev/null 2>&1; then
25 TMPDIR=/mnt/.psplash psplash-write "PROGRESS $progress" || true
26 fi
27}
28
29
21# 30#
22# Start script or program. 31# Start script or program.
23# 32#
24startup() { 33startup() {
34 # Handle verbosity
35 [ "$VERBOSE" = very ] && echo "INIT: Running $@..."
36
25 case "$1" in 37 case "$1" in
26 *.sh) 38 *.sh)
27 sh "$@" 39 # Source shell script for speed.
40 (
41 trap - INT QUIT TSTP
42 scriptname=$1
43 shift
44 . $scriptname
45 )
28 ;; 46 ;;
29 *) 47 *)
30 "$@" 48 "$@"
31 ;; 49 ;;
32 esac 50 esac
51 startup_progress
33} 52}
34 53
35 # Ignore CTRL-C only in this shell, so we can interrupt subprocesses. 54 # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
@@ -56,6 +75,37 @@ startup() {
56 # Is there an rc directory for this new runlevel? 75 # Is there an rc directory for this new runlevel?
57 if [ -d /etc/rc$runlevel.d ] 76 if [ -d /etc/rc$runlevel.d ]
58 then 77 then
78 # Find out where in the progress bar the initramfs got to.
79 PROGRESS_STATE=0
80 #if [ -f /dev/.initramfs/progress_state ]; then
81 # . /dev/.initramfs/progress_state
82 #fi
83
84 # Split the remaining portion of the progress bar into thirds
85 progress_size=$(((100 - $PROGRESS_STATE) / 3))
86
87 case "$runlevel" in
88 0|6)
89 # Count down from 0 to -100 and use the entire bar
90 first_step=0
91 progress_size=100
92 step_change=-1
93 ;;
94 S)
95 # Begin where the initramfs left off and use 2/3
96 # of the remaining space
97 first_step=$PROGRESS_STATE
98 progress_size=$(($progress_size * 2))
99 step_change=1
100 ;;
101 *)
102 # Begin where rcS left off and use the final 1/3 of
103 # the space (by leaving progress_size unchanged)
104 first_step=$(($progress_size * 2 + $PROGRESS_STATE))
105 step_change=1
106 ;;
107 esac
108
59 # First, run the KILL scripts. 109 # First, run the KILL scripts.
60 if [ $previous != N ] 110 if [ $previous != N ]
61 then 111 then
@@ -68,6 +118,19 @@ startup() {
68 startup $i stop 118 startup $i stop
69 done 119 done
70 fi 120 fi
121
122 num_steps=0
123 for s in /etc/rc$runlevel.d/[SK]*; do
124 case "${s##/etc/rc$runlevel.d/S??}" in
125 gdm|xdm|kdm|reboot|halt)
126 break
127 ;;
128 esac
129 num_steps=$(($num_steps + 1))
130 done
131
132 step=0
133
71 # Now run the START scripts for this runlevel. 134 # Now run the START scripts for this runlevel.
72 for i in /etc/rc$runlevel.d/S* 135 for i in /etc/rc$runlevel.d/S*
73 do 136 do
@@ -99,4 +162,10 @@ startup() {
99 esac 162 esac
100 done 163 done
101 fi 164 fi
102# eof /etc/init.d/rc 165
166if [ "x$runlevel" != "xS" ]; then
167 if type psplash-write >/dev/null 2>&1; then
168 TMPDIR=/mnt/.psplash psplash-write "QUIT" || true
169 umount /mnt/.psplash
170 fi
171fi
diff --git a/meta/packages/sysvinit/sysvinit/rcS b/meta/packages/sysvinit/sysvinit/rcS
index e7a7e617d0..90af4149e4 100755
--- a/meta/packages/sysvinit/sysvinit/rcS
+++ b/meta/packages/sysvinit/sysvinit/rcS
@@ -36,63 +36,9 @@ fi
36trap ":" INT QUIT TSTP 36trap ":" INT QUIT TSTP
37 37
38# 38#
39# Do we have /proc/progress and set VERBOSE to "no" ?
40# If so, calculate the number of scripts and the incremental step
41#
42if [ "$VERBOSE" = no ]; then
43 if [ -e /proc/progress ]; then
44 set `ls -1 /etc/rc$runlevel.d/S* | wc`
45 numscripts=$1
46 PROGRESS_incstep=`expr 90 / $1`
47 PROGRESS_value=10
48 PROGRESS=yes
49 export PROGRESS_value PROGRESS_incstep
50 fi
51fi
52export VERBOSE PROGRESS
53
54#
55# Call all parts in order. 39# Call all parts in order.
56# 40#
57for i in /etc/rcS.d/S??* 41exec /etc/init.d/rc S
58do
59 # Ignore dangling symlinks for now.
60 [ ! -f "$i" ] && continue
61
62 # Handle verbosity
63 [ "$VERBOSE" = very ] && echo "INIT: Running $i..."
64 if [ "$PROGRESS" = yes ]; then
65 export PROGRESS_value=`expr $PROGRESS_value + $PROGRESS_incstep`
66 echo "$PROGRESS_value Starting $i..." >/proc/progress
67 fi
68
69 case "$i" in
70 *.sh)
71 # Source shell script for speed.
72 (
73 trap - INT QUIT TSTP
74 set start
75 . $i
76 )
77 ;;
78 *)
79 # No sh extension, so fork subprocess.
80 $i start
81 ;;
82 esac
83
84 #
85 # Report status based on result code
86 #
87 result=$?
88 if [ "$PROGRESS" = yes ]; then
89 if [ "$result" = 0 ]; then
90 echo "=s" >/proc/progress
91 else
92 echo "=f" >/proc/progress
93 fi
94 fi
95done
96 42
97# 43#
98# For compatibility, run the files in /etc/rc.boot too. 44# For compatibility, run the files in /etc/rc.boot too.
diff --git a/meta/packages/sysvinit/sysvinit_2.86.bb b/meta/packages/sysvinit/sysvinit_2.86.bb
index 72ce082da6..4ea1e4d284 100644
--- a/meta/packages/sysvinit/sysvinit_2.86.bb
+++ b/meta/packages/sysvinit/sysvinit_2.86.bb
@@ -2,7 +2,7 @@ DESCRIPTION = "System-V like init."
2SECTION = "base" 2SECTION = "base"
3LICENSE = "GPL" 3LICENSE = "GPL"
4HOMEPAGE = "http://freshmeat.net/projects/sysvinit/" 4HOMEPAGE = "http://freshmeat.net/projects/sysvinit/"
5PR = "r24" 5PR = "r26"
6 6
7# USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf. 7# USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf.
8# Set PACKAGE_ARCH appropriately. 8# Set PACKAGE_ARCH appropriately.