* [Buildroot] [PATCH 1/1] package/openrc: cleanup sysv-rcs script
@ 2019-12-20 0:04 aduskett at gmail.com
2019-12-21 22:03 ` Thomas Petazzoni
0 siblings, 1 reply; 2+ messages in thread
From: aduskett at gmail.com @ 2019-12-20 0:04 UTC (permalink / raw)
To: buildroot
From: Adam Duskett <aduskett@greenlots.com>
Currently, the sysv-rcs script has two issues:
- The return code of each RCS script is not checked.
- The output does not match the formatting of the other openrc
init scripts.
Modify the script in the following ways to fix both issues:
- Remove the "einfo "Starting sysv rc scripts"" at the top of the
start function in favor of "einfo "Starting $i" in the loop
itself.
- Add a "> /dev/null" to the end of $i start; this suppresses
stdout while still allowing for stderr messages to print to the
terminal.
- add an "eend $? to both the start and stop functions, this
allows for openrc to show if an RCS script returned 0 or
not.
The following is the startup output of OpenRC on a minimal system
with S01syslogd modified to exit with a return code 1 for testing
purposes:
Before:
* Adding static routes ...
[ ok ]
Starting default runlevel
* Starting sysv rc scripts
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
After:
* Adding static routes ...
[ ok ]
Starting default runlevel
* Starting /etc/init.d/S01syslogd ...
[ !! ]
* Starting /etc/init.d/S02klogd ...
[ ok ]
* Starting /etc/init.d/S02sysctl ...
[ ok ]
Signed-off-by: Adam Duskett <aduskett@greenlots.com>
---
package/openrc/sysv-rcs | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/package/openrc/sysv-rcs b/package/openrc/sysv-rcs
index 606a73d2b4..1564cbe603 100755
--- a/package/openrc/sysv-rcs
+++ b/package/openrc/sysv-rcs
@@ -7,19 +7,21 @@ depend() {
}
start() {
- einfo "Starting sysv rc scripts"
for i in /etc/init.d/S??*; do
# Ignore dangling symlinks (if any).
[ -e "$i" ] || continue
- $i start
+ einfo "Starting $i"
+ $i start > /dev/null
+ eend $?
done
}
stop() {
- einfo "Stopping sysv rc scripts"
for i in $(ls -r /etc/init.d/S??*); do
# Ignore dangling symlinks (if any).
[ -e "$i" ] || continue
- $i stop
+ einfo "Stopping $i"
+ $i stop > /dev/null
+ eend $?
done
}
--
2.24.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* [Buildroot] [PATCH 1/1] package/openrc: cleanup sysv-rcs script
2019-12-20 0:04 [Buildroot] [PATCH 1/1] package/openrc: cleanup sysv-rcs script aduskett at gmail.com
@ 2019-12-21 22:03 ` Thomas Petazzoni
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2019-12-21 22:03 UTC (permalink / raw)
To: buildroot
On Thu, 19 Dec 2019 16:04:37 -0800
aduskett at gmail.com wrote:
> From: Adam Duskett <aduskett@greenlots.com>
>
> Currently, the sysv-rcs script has two issues:
> - The return code of each RCS script is not checked.
> - The output does not match the formatting of the other openrc
> init scripts.
>
> Modify the script in the following ways to fix both issues:
> - Remove the "einfo "Starting sysv rc scripts"" at the top of the
> start function in favor of "einfo "Starting $i" in the loop
> itself.
>
> - Add a "> /dev/null" to the end of $i start; this suppresses
> stdout while still allowing for stderr messages to print to the
> terminal.
>
> - add an "eend $? to both the start and stop functions, this
> allows for openrc to show if an RCS script returned 0 or
> not.
>
> The following is the startup output of OpenRC on a minimal system
> with S01syslogd modified to exit with a return code 1 for testing
> purposes:
>
> Before:
> * Adding static routes ...
> [ ok ]
> Starting default runlevel
> * Starting sysv rc scripts
> Starting syslogd: OK
> Starting klogd: OK
> Running sysctl: OK
>
> After:
> * Adding static routes ...
> [ ok ]
> Starting default runlevel
> * Starting /etc/init.d/S01syslogd ...
> [ !! ]
> * Starting /etc/init.d/S02klogd ...
> [ ok ]
> * Starting /etc/init.d/S02sysctl ...
> [ ok ]
>
> Signed-off-by: Adam Duskett <aduskett@greenlots.com>
> ---
> package/openrc/sysv-rcs | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-21 22:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-20 0:04 [Buildroot] [PATCH 1/1] package/openrc: cleanup sysv-rcs script aduskett at gmail.com
2019-12-21 22:03 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox