1 |
diff -Nur -x '*.orig' -x '*.rej' e-smith-base-4.18.0/root/etc/rc.d/rc.e-smith mezzanine_patched_e-smith-base-4.18.0/root/etc/rc.d/rc.e-smith |
2 |
--- e-smith-base-4.18.0/root/etc/rc.d/rc.e-smith 2005-11-20 21:28:10.000000000 -0700 |
3 |
+++ mezzanine_patched_e-smith-base-4.18.0/root/etc/rc.d/rc.e-smith 2007-03-22 15:42:41.000000000 -0600 |
4 |
@@ -3,6 +3,25 @@ |
5 |
# Customisation of the RedHat rc script, which allows services to return |
6 |
# a value of 99, indicating "disabled" |
7 |
|
8 |
+# Check whether file $1 is a backup or rpm-generated file and should be ignored |
9 |
+is_ignored_file() { |
10 |
+ case "$1" in |
11 |
+ *~ | *.bak | *.orig | *.rpmnew | *.rpmorig | *.rpmsave) |
12 |
+ return 0 |
13 |
+ ;; |
14 |
+ esac |
15 |
+ return 1 |
16 |
+} |
17 |
+ |
18 |
+# check a file to be a correct runlevel script |
19 |
+check_runlevel () |
20 |
+{ |
21 |
+ # Check if the file exists at all. |
22 |
+ [ -x "$1" ] || return 1 |
23 |
+ is_ignored_file "$1" && return 1 |
24 |
+ return 0 |
25 |
+} |
26 |
+ |
27 |
# Now find out what the current and what the previous runlevel are. |
28 |
argv1="$1" |
29 |
set `/sbin/runlevel` |
30 |
@@ -62,67 +81,38 @@ |
31 |
|
32 |
# Log that something succeeded |
33 |
success() { |
34 |
- if [ -z "${IN_INITLOG:-}" ]; then |
35 |
- initlog $INITLOG_ARGS -n $0 -s "$1" -e 1 |
36 |
- else |
37 |
- # silly hack to avoid EPIPE killing rc.sysinit |
38 |
- trap "" SIGPIPE |
39 |
- echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21 |
40 |
- trap - SIGPIPE |
41 |
- fi |
42 |
[ "$BOOTUP" != "verbose" -a -z "$LSB" ] && echo_success |
43 |
return 0 |
44 |
} |
45 |
|
46 |
# Log that something failed |
47 |
failure() { |
48 |
- rc=$? |
49 |
- if [ -z "${IN_INITLOG:-}" ]; then |
50 |
- initlog $INITLOG_ARGS -n $0 -s "$1" -e 2 |
51 |
- else |
52 |
- trap "" SIGPIPE |
53 |
- echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 2" >&21 |
54 |
- trap - SIGPIPE |
55 |
- fi |
56 |
+ local rc=$? |
57 |
[ "$BOOTUP" != "verbose" -a -z "$LSB" ] && echo_failure |
58 |
return $rc |
59 |
} |
60 |
|
61 |
# Log a warning |
62 |
warning() { |
63 |
- rc=$? |
64 |
- if [ -z "${IN_INITLOG:-}" ]; then |
65 |
- initlog $INITLOG_ARGS -n $0 -s "$1" -e 1 |
66 |
- else |
67 |
- trap "" SIGPIPE |
68 |
- echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21 |
69 |
- trap - SIGPIPE |
70 |
- fi |
71 |
+ local rc=$? |
72 |
[ "$BOOTUP" != "verbose" -a -z "$LSB" ] && echo_warning |
73 |
return $rc |
74 |
} |
75 |
|
76 |
# Log that something passed, but is disabled in this configuration |
77 |
disabled() { |
78 |
- rc=$? |
79 |
- if [ -z "$IN_INITLOG" ]; then |
80 |
- initlog $INITLOG_ARGS -n $0 -s "$1" -e 1 |
81 |
- else |
82 |
- trap "" SIGPIPE |
83 |
- echo "$INITLOG_ARGS -n $0 -s \"$1\" -e 1" >&21 |
84 |
- trap - SIGPIPE |
85 |
- fi |
86 |
+ local rc=$? |
87 |
[ "$BOOTUP" != "verbose" ] && echo_disabled |
88 |
return $rc |
89 |
} |
90 |
|
91 |
# Run some action. Log its output. |
92 |
action() { |
93 |
- STRING=$1 |
94 |
+ local STRING=$1 |
95 |
echo -n "$STRING " |
96 |
shift |
97 |
- initlog $INITLOG_ARGS -c "$*" |
98 |
- ret=$? |
99 |
+ "$@" |
100 |
+ local ret=$? |
101 |
case $ret in |
102 |
0) success $"$STRING" ;; |
103 |
99) disabled $"$STRING" |
104 |
@@ -133,105 +123,68 @@ |
105 |
return $ret |
106 |
} |
107 |
|
108 |
- |
109 |
# See if we want to be in user confirmation mode |
110 |
if [ "$previous" = "N" ]; then |
111 |
- if grep -i confirm /proc/cmdline >/dev/null || [ -f /var/run/confirm ] ; then |
112 |
- rm -f /var/run/confirm |
113 |
- CONFIRM=yes |
114 |
- echo $"Entering interactive startup" |
115 |
- else |
116 |
- CONFIRM= |
117 |
- echo $"Entering non-interactive startup" |
118 |
- fi |
119 |
+ if [ -f /var/run/confirm ]; then |
120 |
+ echo $"Entering interactive startup" |
121 |
+ else |
122 |
+ echo $"Entering non-interactive startup" |
123 |
+ fi |
124 |
fi |
125 |
|
126 |
-export CONFIRM |
127 |
- |
128 |
# Get first argument. Set new runlevel to this argument. |
129 |
[ -n "$argv1" ] && runlevel="$argv1" |
130 |
|
131 |
# Is there an rc directory for this new runlevel? |
132 |
-if [ -d /etc/rc$runlevel.d ]; then |
133 |
- # First, run the KILL scripts. |
134 |
- for i in /etc/rc$runlevel.d/K*; do |
135 |
- # Check if the script is there. |
136 |
- [ ! -f $i ] && continue |
137 |
- |
138 |
- # Don't run [KS]??foo.{rpmsave,rpmorig} scripts |
139 |
- [ "${i%.rpmsave}" != "${i}" ] && continue |
140 |
- [ "${i%.rpmorig}" != "${i}" ] && continue |
141 |
- [ "${i%.rpmnew}" != "${i}" ] && continue |
142 |
- |
143 |
- # Check if the subsystem is already up. |
144 |
- subsys=${i#/etc/rc$runlevel.d/K??} |
145 |
- [ ! -f /var/lock/subsys/$subsys ] && \ |
146 |
- [ ! -f /var/lock/subsys/${subsys}.init ] && continue |
147 |
- |
148 |
- # Bring the subsystem down. |
149 |
- if egrep -q "(killproc |action )" $i ; then |
150 |
- $i stop |
151 |
- else |
152 |
- action $"Stopping $subsys: " $i stop |
153 |
- fi |
154 |
- done |
155 |
- |
156 |
- # Now run the START scripts. |
157 |
- for i in /etc/rc$runlevel.d/S*; do |
158 |
- # Check if the script is there. |
159 |
- [ ! -f $i ] && continue |
160 |
- |
161 |
- # Don't run [KS]??foo.{rpmsave,rpmorig} scripts |
162 |
- [ "${i%.rpmsave}" != "${i}" ] && continue |
163 |
- [ "${i%.rpmorig}" != "${i}" ] && continue |
164 |
- [ "${i%.rpmnew}" != "${i}" ] && continue |
165 |
- |
166 |
- # Check if the subsystem is already up. |
167 |
- subsys=${i#/etc/rc$runlevel.d/S??} |
168 |
- [ -f /var/lock/subsys/$subsys ] || \ |
169 |
- [ -f /var/lock/subsys/${subsys}.init ] && continue |
170 |
+[ -d /etc/rc$runlevel.d ] || exit 0 |
171 |
+ |
172 |
+# First, run the KILL scripts. |
173 |
+for i in /etc/rc$runlevel.d/K* ; do |
174 |
+ check_runlevel "$i" || continue |
175 |
+ |
176 |
+ # Check if the subsystem is already up. |
177 |
+ subsys=${i#/etc/rc$runlevel.d/K??} |
178 |
+ [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \ |
179 |
+ || continue |
180 |
+ |
181 |
+ # Bring the subsystem down. |
182 |
+ if LC_ALL=C egrep -q "^..*init.d/functions" $i ; then |
183 |
+ $i stop |
184 |
+ else |
185 |
+ action $"Stopping $subsys: " $i stop |
186 |
+ fi |
187 |
+done |
188 |
+ |
189 |
+# Now run the START scripts. |
190 |
+for i in /etc/rc$runlevel.d/S* ; do |
191 |
+ check_runlevel "$i" || continue |
192 |
+ |
193 |
+ # Check if the subsystem is already up. |
194 |
+ subsys=${i#/etc/rc$runlevel.d/S??} |
195 |
+ [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \ |
196 |
+ && continue |
197 |
|
198 |
- # If we're in confirmation mode, get user confirmation |
199 |
- [ -n "$CONFIRM" ] && |
200 |
- { |
201 |
- confirm $subsys |
202 |
- case $? in |
203 |
- 0) |
204 |
- : |
205 |
- ;; |
206 |
- 2) |
207 |
- CONFIRM= |
208 |
- ;; |
209 |
- *) |
210 |
- continue |
211 |
- ;; |
212 |
- esac |
213 |
- } |
214 |
- |
215 |
- # Bring the subsystem up. |
216 |
- if egrep -q "(daemon |action )" $i ; then |
217 |
- if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then |
218 |
- unset LANG |
219 |
- unset LC_ALL |
220 |
- unset TEXTDOMAIN |
221 |
- unset TEXTDOMAINDIR |
222 |
- exec $i start |
223 |
- else |
224 |
- $i start |
225 |
- fi |
226 |
- else |
227 |
- if [ "$subsys" = "halt" -o "$subsys" = "reboot" -o "$subsys" = "single" -o "$subsys" = "local" ]; then |
228 |
- if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then |
229 |
- unset LANG |
230 |
- unset LC_ALL |
231 |
- unset TEXTDOMAIN |
232 |
- unset TEXTDOMAINDIR |
233 |
- exec $i start |
234 |
- fi |
235 |
- $i start |
236 |
- else |
237 |
- action $"Starting $subsys: " $i start |
238 |
- fi |
239 |
- fi |
240 |
- done |
241 |
+ # If we're in confirmation mode, get user confirmation |
242 |
+ if [ -f /var/run/confirm ]; then |
243 |
+ confirm $subsys |
244 |
+ test $? = 1 && continue |
245 |
+ fi |
246 |
+ |
247 |
+ update_boot_stage "$subsys" |
248 |
+ # Bring the subsystem up. |
249 |
+ if [ "$subsys" = "halt" -o "$subsys" = "reboot" ]; then |
250 |
+ export LC_ALL=C |
251 |
+ exec $i start |
252 |
+ fi |
253 |
+ if LC_ALL=C egrep -q "^..*init.d/functions" $i \ |
254 |
+ || [ "$subsys" = "single" -o "$subsys" = "local" ]; then |
255 |
+ $i start |
256 |
+ else |
257 |
+ action $"Starting $subsys: " $i start |
258 |
+ fi |
259 |
+done |
260 |
+rm -f /var/run/confirm |
261 |
+if [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then |
262 |
+ /usr/bin/rhgb-client --quit |
263 |
fi |
264 |
+ |