aboutsummaryrefslogtreecommitdiff
path: root/libexec/rc/rc.subr
diff options
context:
space:
mode:
authorJose Luis Duran <jlduran@gmail.com>2022-03-13 17:48:06 +0000
committerMateusz Piotrowski <0mp@FreeBSD.org>2022-03-13 17:57:29 +0000
commit325ebf37d8efc6488754051fcc2b1aaa40cefd8b (patch)
tree37a7adafa90b752fc9190ea388e9a8ef6b8016fe /libexec/rc/rc.subr
parente83a53abeb90258206285be517af2f2045caa78b (diff)
downloadsrc-325ebf37d8efc6488754051fcc2b1aaa40cefd8b.tar.gz
src-325ebf37d8efc6488754051fcc2b1aaa40cefd8b.zip
Introduce startmsg and use it in rc scripts
startmsg is a new rc.subr(8) function function to be used instead of echo(1) when for boot messages. It replaces the often forgotten check_startmsgs && echo ... with startmsg ... No functional change intended. I adjusted the commit message and did some final clean-ups of the patch before committing. PR: 255207 Reported by: Jose Luis Duran <jlduran@gmail.com> Reviewed by: imp, 0mp Approved by: imp (src) Differential Revision: https://reviews.freebsd.org/D34514
Diffstat (limited to 'libexec/rc/rc.subr')
-rw-r--r--libexec/rc/rc.subr11
1 files changed, 10 insertions, 1 deletions
diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
index 76f878c11e29..dc4f49612c29 100644
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -716,6 +716,15 @@ check_startmsgs()
}
#
+# startmsg
+# Preferred method to use when displaying start messages in lieu of echo.
+#
+startmsg()
+{
+ check_startmsgs && echo "$@"
+}
+
+#
# run_rc_command argument
# Search for argument in the list of supported commands, which is:
# "start stop restart rcvar status poll ${extra_commands}"
@@ -1111,7 +1120,7 @@ run_rc_command()
# setup the full command to run
#
- check_startmsgs && echo "Starting ${name}."
+ startmsg "Starting ${name}."
if [ -n "$_chroot" ]; then
_cd=
_doit="\