Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Feb 2023 12:29:18 GMT
From:      Mateusz Piotrowski <0mp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e8396a9592ab - stable/13 - rc.d/*: Use startmsg instead of echo on start messages
Message-ID:  <202302221229.31MCTIfY042550@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by 0mp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e8396a9592abb08069009e48b84ead2636681b16

commit e8396a9592abb08069009e48b84ead2636681b16
Author:     Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-03-13 17:54:39 +0000
Commit:     Mateusz Piotrowski <0mp@FreeBSD.org>
CommitDate: 2023-02-22 12:27:50 +0000

    rc.d/*: Use startmsg instead of echo on start messages
    
    By rc.conf(5), setting rc_startmsgs="NO" should silence start messages.
    
    Fix a few rc scripts by using startmsg.
    
    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
    
    (cherry picked from commit 19a6267d61a0c3bd6cd56f19ca3f8a67a54f675c)
---
 libexec/rc/rc.d/jail               | 16 ++++++++--------
 libexec/rc/rc.d/local              |  4 ++--
 libexec/rc/rc.d/netif              |  2 +-
 libexec/rc/rc.d/ppp                |  6 +++---
 libexec/rc/rc.d/pppoed             |  2 +-
 libexec/rc/rc.d/rfcomm_pppd_server |  6 +++---
 6 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/libexec/rc/rc.d/jail b/libexec/rc/rc.d/jail
index 1d544501e32b..d95af40f459e 100755
--- a/libexec/rc/rc.d/jail
+++ b/libexec/rc/rc.d/jail
@@ -450,7 +450,7 @@ jail_start()
 	if [ $# = 0 ]; then
 		return
 	fi
-	echo -n 'Starting jails:'
+	startmsg -n 'Starting jails:'
 	case $1 in
 	_ALL)
 		command=$jail_program
@@ -462,14 +462,14 @@ jail_start()
 		_tmp=`mktemp -t jail` || exit 3
 		if $command $rc_flags $command_args >> $_tmp 2>&1; then
 			$jail_jls jid name | while read _id _name; do
-				echo -n " $_name"
+				startmsg -n " $_name"
 				echo $_id > /var/run/jail_${_name}.id
 			done
 		else
 			cat $_tmp
 		fi
 		rm -f $_tmp
-		echo '.'
+		startmsg '.'
 		return
 	;;
 	esac
@@ -490,11 +490,11 @@ jail_start()
 				_tmp=`mktemp -t jail_${_j}` || exit 3
 				if $command $rc_flags $command_args \
 				    >> $_tmp 2>&1 </dev/null; then
-					echo -n " ${_hostname:-${_j}}"
+					startmsg -n " ${_hostname:-${_j}}"
 					_jid=$($jail_jls -j $_j jid)
 					echo $_jid > /var/run/jail_${_j}.id
 				else
-					echo " cannot start jail " \
+					startmsg " cannot start jail " \
 					    "\"${_hostname:-${_j}}\": "
 					cat $_tmp
 				fi
@@ -517,18 +517,18 @@ jail_start()
 			_tmp=`mktemp -t jail` || exit 3
 			if $command $rc_flags $command_args \
 			    >> $_tmp 2>&1 </dev/null; then
-				echo -n " ${_hostname:-${_j}}"
+				startmsg -n " ${_hostname:-${_j}}"
 				_jid=$($jail_jls -j $_j jid)
 				echo $_jid > /var/run/jail_${_j}.id
 			else
-				echo " cannot start jail " \
+				startmsg " cannot start jail " \
 				    "\"${_hostname:-${_j}}\": "
 				cat $_tmp
 			fi
 			rm -f $_tmp
 		done
 	fi
-	echo '.'
+	startmsg '.'
 }
 
 jail_stop()
diff --git a/libexec/rc/rc.d/local b/libexec/rc/rc.d/local
index ba17a674ae9d..53907ad27011 100755
--- a/libexec/rc/rc.d/local
+++ b/libexec/rc/rc.d/local
@@ -18,9 +18,9 @@ stop_cmd="local_stop"
 local_start()
 {
 	if [ -f /etc/rc.local ]; then
-		echo -n 'Starting local daemons:'
+		startmsg -n 'Starting local daemons:'
 		. /etc/rc.local
-		echo '.'
+		startmsg '.'
 	fi
 }
 
diff --git a/libexec/rc/rc.d/netif b/libexec/rc/rc.d/netif
index 3dbb3e1a9588..bb401a6d5ce4 100755
--- a/libexec/rc/rc.d/netif
+++ b/libexec/rc/rc.d/netif
@@ -247,7 +247,7 @@ netif_common()
 			_str='Reclaiming'
 		;;
 		esac
-		echo "${_str} Network:${_ok}."
+		startmsg "${_str} Network:${_ok}."
 		case ${_func} in
 		ifn_vnetup)
 			# Clear _ok not to do "ifconfig $ifn"
diff --git a/libexec/rc/rc.d/ppp b/libexec/rc/rc.d/ppp
index 93d0655b296f..8dbff30a7e32 100755
--- a/libexec/rc/rc.d/ppp
+++ b/libexec/rc/rc.d/ppp
@@ -82,14 +82,14 @@ ppp_start()
 		_ppp_profile=$ppp_profile
 	fi
 
-	echo -n "Starting PPP profile:"
+	startmsg -n "Starting PPP profile:"
 
 	for _p in $_ppp_profile; do
-		echo -n " $_p"
+		startmsg -n " $_p"
 		ppp_start_profile $_p
 	done
 
-	echo "."
+	startmsg "."
 }
 
 ppp_poststart()
diff --git a/libexec/rc/rc.d/pppoed b/libexec/rc/rc.d/pppoed
index 7e848595e833..c368b32008a1 100755
--- a/libexec/rc/rc.d/pppoed
+++ b/libexec/rc/rc.d/pppoed
@@ -24,7 +24,7 @@ pppoed_start()
 	if [ -n "${pppoed_provider}" ]; then
 			pppoed_flags="${pppoed_flags} -p ${pppoed_provider}"
 	fi
-	echo 'Starting pppoed'
+	startmsg 'Starting pppoed'
 	_opts=$-; set -f
 	/usr/libexec/pppoed ${pppoed_flags} ${pppoed_interface}
 	set +f; set -${_opts}
diff --git a/libexec/rc/rc.d/rfcomm_pppd_server b/libexec/rc/rc.d/rfcomm_pppd_server
index 990a22475b0e..a7035f6e4ea7 100755
--- a/libexec/rc/rc.d/rfcomm_pppd_server
+++ b/libexec/rc/rc.d/rfcomm_pppd_server
@@ -90,14 +90,14 @@ rfcomm_pppd_server_start()
 		_profile=${rfcomm_pppd_server_profile}
 	fi
 
-	echo -n "Starting RFCOMM PPP profile:"
+	startmsg -n "Starting RFCOMM PPP profile:"
 
 	for _p in ${_profile} ; do
-		echo -n " ${_p}"
+		startmsg -n " ${_p}"
 		rfcomm_pppd_server_start_profile ${_p}
 	done
 
-	echo "."
+	startmsg "."
 }
 
 rfcomm_pppd_server_stop()



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302221229.31MCTIfY042550>