summaryrefslogtreecommitdiffstats
path: root/meta/packages/sysvinit/sysvinit/rcS
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/sysvinit/sysvinit/rcS')
-rwxr-xr-xmeta/packages/sysvinit/sysvinit/rcS110
1 files changed, 110 insertions, 0 deletions
diff --git a/meta/packages/sysvinit/sysvinit/rcS b/meta/packages/sysvinit/sysvinit/rcS
new file mode 100755
index 0000000000..e7a7e617d0
--- /dev/null
+++ b/meta/packages/sysvinit/sysvinit/rcS
@@ -0,0 +1,110 @@
1#!/bin/sh
2#
3# rcS Call all S??* scripts in /etc/rcS.d in
4# numerical/alphabetical order.
5#
6# Version: @(#)/etc/init.d/rcS 2.76 19-Apr-1999 miquels@cistron.nl
7#
8
9PATH=/sbin:/bin:/usr/sbin:/usr/bin
10runlevel=S
11prevlevel=N
12umask 022
13export PATH runlevel prevlevel
14
15# Make sure proc is mounted
16#
17[ -d "/proc/1" ] || mount /proc
18
19#
20# See if system needs to be setup. This is ONLY meant to
21# be used for the initial setup after a fresh installation!
22#
23if [ -x /sbin/unconfigured.sh ]
24then
25 /sbin/unconfigured.sh
26fi
27
28#
29# Source defaults.
30#
31. /etc/default/rcS
32
33#
34# Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
35#
36trap ":" INT QUIT TSTP
37
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.
56#
57for i in /etc/rcS.d/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
97#
98# For compatibility, run the files in /etc/rc.boot too.
99#
100[ -d /etc/rc.boot ] && run-parts /etc/rc.boot
101
102#
103# Finish setup if needed. The comment above about
104# /sbin/unconfigured.sh applies here as well!
105#
106if [ -x /sbin/setup.sh ]
107then
108 /sbin/setup.sh
109fi
110