Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/
Date: Wed, 09 Jul 2014 20:39:26
Message-Id: 1404938028.57b9e601a97fac3a044ec5d7e5f11b6219c892b7.williamh@OpenRC
1 commit: 57b9e601a97fac3a044ec5d7e5f11b6219c892b7
2 Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
3 AuthorDate: Sat Jul 5 19:30:33 2014 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 9 20:33:48 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=57b9e601
7
8 init.d/local: bring functioning more in line with how sysctl works
9
10 - remove the has_executables variable since it isn't used.
11 - Convert the conditional calls to ewend/vewend to a single call to veend.
12 - Always call eend after all scripts are executed passing the appropriate
13 error code.
14
15 Because of this change, you will see only an overall status when
16 starting or stopping local unless you are using verbose mode.
17
18 ---
19 init.d/local.in | 22 ++++++----------------
20 1 file changed, 6 insertions(+), 16 deletions(-)
21
22 diff --git a/init.d/local.in b/init.d/local.in
23 index 06be25f..180735d 100644
24 --- a/init.d/local.in
25 +++ b/init.d/local.in
26 @@ -14,20 +14,17 @@ start()
27 {
28 ebegin "Starting local"
29
30 - local file has_errors retval
31 + local file has_errors=0 retval
32 eindent
33 for file in @SYSCONFDIR@/local.d/*.start; do
34 if [ -x "${file}" ]; then
35 - has_executables=1
36 vebegin "Executing \"${file}\""
37 "${file}" 2>&1 >/dev/null
38 retval=$?
39 if [ ${retval} -ne 0 ]; then
40 has_errors=1
41 - ewend ${retval} "Execution of \"${file}\" failed."
42 - else
43 - vewend 0
44 fi
45 + veend ${retval} "Execution of \"${file}\" failed."
46 fi
47 done
48 eoutdent
49 @@ -40,9 +37,7 @@ start()
50 local_start
51 fi
52
53 - if [ -z "${has_errors}" ]; then
54 - eend 0
55 - fi
56 + eend ${has_errors}
57
58 # We have to end with a zero exit code, because a failed execution
59 # of an executable @SYSCONFDIR@/local.d/*.start file shouldn't result in
60 @@ -57,20 +52,17 @@ stop()
61 {
62 ebegin "Stopping local"
63
64 - local file has_errors retval
65 + local file has_errors=0 retval
66 eindent
67 for file in @SYSCONFDIR@/local.d/*.stop; do
68 if [ -x "${file}" ]; then
69 - has_executables=1
70 vebegin "Executing \"${file}\""
71 "${file}" 2>&1 >/dev/null
72 retval=$?
73 if [ ${retval} -ne 0 ]; then
74 has_errors=1
75 - ewend ${retval} "Execution of \"${file}\" failed."
76 - else
77 - vewend 0
78 fi
79 + veend ${retval} "Execution of \"${file}\" failed."
80 fi
81 done
82 eoutdent
83 @@ -83,9 +75,7 @@ stop()
84 local_stop
85 fi
86
87 - if [ -z "${has_errors}" ]; then
88 - eend 0
89 - fi
90 + eend ${has_errors}
91
92 # An executable @SYSCONFDIR@/local.d/*.stop file which failed with a
93 # non-zero exit status is not a reason to mark this service