Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Oct 2009 00:17:09 +0000 (UTC)
From:      Doug Barton <dougb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r198164 - in stable/8/etc: . rc.d
Message-ID:  <200910160017.n9G0H9VX088524@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dougb
Date: Fri Oct 16 00:17:09 2009
New Revision: 198164
URL: http://svn.freebsd.org/changeset/base/198164

Log:
  MFC r197947:
  
  In regards to the "Starting foo:" type messages at boot time, create
  and employ a more generic solution, and use it in the individual rc.d
  scripts that also have an $rc_quiet test:
  
  1. Add check_startmsgs() to rc.subr.
  2. In the rc.d scripts that use rc_quiet (and rc.subr) substitute
  variations of [ -z "$rc_quiet" ] with check_startmsgs
  3. In savecore add a trailing '.' to the end of the message to make it
  more consistent with other scripts.
  4. In newsyslog remove a : before the terminal '.' since we do not
  expect there to be anything printed out in between to make it more
  consistent.
  5. In the following scripts change "quotes" to 'quotes' where no
  variables exist in the message: savecore pf newsyslog
  6. [Does not apply in RELENG_8]
  7. In the following scripts separate the "Starting foo:" from the
  terminal '.' to make them more consistent: moused hostname pf
  8. In nfsclient move the message to its own line to avoid a style bug
  9. In pf rc_quiet does not apply to the _stop method, so remove the
  test there.
  10. In motd add 'quotes' around the terminal '.' for consistency
  
  Approved by:	re (kib)

Modified:
  stable/8/etc/   (props changed)
  stable/8/etc/rc.d/bgfsck
  stable/8/etc/rc.d/cleartmp
  stable/8/etc/rc.d/fsck
  stable/8/etc/rc.d/hostid
  stable/8/etc/rc.d/hostname
  stable/8/etc/rc.d/ldconfig
  stable/8/etc/rc.d/motd
  stable/8/etc/rc.d/mountcritlocal
  stable/8/etc/rc.d/moused
  stable/8/etc/rc.d/netif
  stable/8/etc/rc.d/newsyslog
  stable/8/etc/rc.d/nfsclient
  stable/8/etc/rc.d/pf
  stable/8/etc/rc.d/savecore
  stable/8/etc/rc.subr

Modified: stable/8/etc/rc.d/bgfsck
==============================================================================
--- stable/8/etc/rc.d/bgfsck	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/bgfsck	Fri Oct 16 00:17:09 2009	(r198164)
@@ -31,7 +31,7 @@ bgfsck_start ()
 		bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds"
 	fi
 	if [ -z "${rc_force}" ]; then
-		[ -z "${rc_quiet}" ] && echo "${bgfsck_msg}."
+		check_startmsgs && echo "${bgfsck_msg}."
 	fi
 
 	(sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \

Modified: stable/8/etc/rc.d/cleartmp
==============================================================================
--- stable/8/etc/rc.d/cleartmp	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/cleartmp	Fri Oct 16 00:17:09 2009	(r198164)
@@ -25,7 +25,7 @@ cleartmp_start()
 			       ${tmp}/.ICE-unix ${tmp}/.font-unix"
 
 	if checkyesno ${rcvar1}; then
-		[ -z "${rc_quiet}" ] && echo "Clearing ${tmp}."
+		check_startmsgs && echo "Clearing ${tmp}."
 
 		# This is not needed for mfs, but doesn't hurt anything.
 		# Things to note:
@@ -44,7 +44,7 @@ cleartmp_start()
 	elif checkyesno clear_tmp_X; then
 		# Remove X lock files, since they will prevent you from
 		# restarting X.  Remove other X related directories.
-		[ -z "${rc_quiet}" ] && echo "Clearing ${tmp} (X related)."
+		check_startmsgs && echo "Clearing ${tmp} (X related)."
 		rm -rf ${tmp}/.X[0-9]-lock ${x11_socket_dirs}
 	fi
 	if checkyesno clear_tmp_X; then

Modified: stable/8/etc/rc.d/fsck
==============================================================================
--- stable/8/etc/rc.d/fsck	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/fsck	Fri Oct 16 00:17:09 2009	(r198164)
@@ -23,7 +23,7 @@ fsck_start()
 					# During fsck ignore SIGQUIT
 		trap : 3
 
-		[ -z "${rc_quiet}" ] && echo "Starting file system checks:"
+		check_startmsgs && echo "Starting file system checks:"
 		if checkyesno background_fsck; then
 			fsck -F -p
 		else

Modified: stable/8/etc/rc.d/hostid
==============================================================================
--- stable/8/etc/rc.d/hostid	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/hostid	Fri Oct 16 00:17:09 2009	(r198164)
@@ -49,9 +49,9 @@ hostid_set()
 
 	# Set both kern.hostuuid and kern.hostid.
 	#
-	[ -z "${rc_quiet}" ] && echo "Setting hostuuid: ${uuid}."
+	check_startmsgs && echo "Setting hostuuid: ${uuid}."
 	${SYSCTL_W} kern.hostuuid="${uuid}" >/dev/null
-	[ -z "${rc_quiet}" ] && echo "Setting hostid: ${id}."
+	check_startmsgs && echo "Setting hostid: ${id}."
 	${SYSCTL_W} kern.hostid=${id} >/dev/null
 }
 

Modified: stable/8/etc/rc.d/hostname
==============================================================================
--- stable/8/etc/rc.d/hostname	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/hostname	Fri Oct 16 00:17:09 2009	(r198164)
@@ -72,8 +72,9 @@ hostname_start()
 
 	# All right, it is safe to invoke hostname(1) now.
 	#
-	[ -z "${rc_quiet}" ] && echo "Setting hostname: ${hostname}."
+	check_startmsgs && echo -n "Setting hostname: ${hostname}"
 	/bin/hostname "${hostname}"
+	check_startmsgs && echo '.'
 }
 
 load_rc_config $name

Modified: stable/8/etc/rc.d/ldconfig
==============================================================================
--- stable/8/etc/rc.d/ldconfig	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/ldconfig	Fri Oct 16 00:17:09 2009	(r198164)
@@ -36,7 +36,7 @@ ldconfig_start()
 				_LDC="${_LDC} ${i}"
 			fi
 		done
-		[ -z "${rc_quiet}" ] && echo 'ELF ldconfig path:' ${_LDC}
+		check_startmsgs && echo 'ELF ldconfig path:' ${_LDC}
 		${ldconfig} -elf ${_ins} ${_LDC}
 
 		case `sysctl -n hw.machine_arch` in
@@ -55,7 +55,7 @@ ldconfig_start()
 					_LDC="${_LDC} ${i}"
 				fi
 			done
-			[ -z "${rc_quiet}" ] &&
+			check_startmsgs &&
 			    echo '32-bit compatibility ldconfig path:' ${_LDC}
 			${ldconfig} -32 -m ${_ins} ${_LDC}
 			;;
@@ -72,8 +72,7 @@ ldconfig_start()
 					_LDC="${_LDC} ${i}"
 				fi
 			done
-			[ -z "${rc_quiet}" ] &&
-			    echo 'a.out ldconfig path:' ${_LDC}
+			check_startmsgs && echo 'a.out ldconfig path:' ${_LDC}
 			${ldconfig} -aout ${_ins} ${_LDC}
 			;;
 		esac

Modified: stable/8/etc/rc.d/motd
==============================================================================
--- stable/8/etc/rc.d/motd	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/motd	Fri Oct 16 00:17:09 2009	(r198164)
@@ -22,7 +22,7 @@ motd_start()
 	#	Must be done *before* interactive logins are possible
 	#	to prevent possible race conditions.
 	#
-	[ -z "${rc_quiet}" ] && echo -n 'Updating motd:'
+	check_startmsgs && echo -n 'Updating motd:'
 	if [ ! -f /etc/motd ]; then
 		install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd
 	fi
@@ -42,7 +42,7 @@ motd_start()
 	}
 	rm -f $T
 
-	[ -z "${rc_quiet}" ] && echo .
+	check_startmsgs && echo '.'
 }
 
 load_rc_config $name

Modified: stable/8/etc/rc.d/mountcritlocal
==============================================================================
--- stable/8/etc/rc.d/mountcritlocal	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/mountcritlocal	Fri Oct 16 00:17:09 2009	(r198164)
@@ -28,7 +28,7 @@ mountcritlocal_start()
 	esac
 
 	# Mount everything except nfs filesystems.
-	[ -z "${rc_quiet}" ] && echo -n 'Mounting local file systems:'
+	check_startmsgs && echo -n 'Mounting local file systems:'
 	mount_excludes='no'
 	for i in ${netfs_types}; do
 		fstype=${i%:*}
@@ -37,7 +37,7 @@ mountcritlocal_start()
 	mount_excludes=${mount_excludes%,}
 	mount -a -t ${mount_excludes}
 	err=$?
-	[ -z "${rc_quiet}" ] && echo '.'
+	check_startmsgs && echo '.'
 
 	case ${err} in
 	0)

Modified: stable/8/etc/rc.d/moused
==============================================================================
--- stable/8/etc/rc.d/moused	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/moused	Fri Oct 16 00:17:09 2009	(r198164)
@@ -51,8 +51,9 @@ moused_start()
 		mytype="$moused_type"
 	fi
 
-	[ -z "${rc_quiet}" ] && echo -n "Starting ${ms} moused."
+	check_startmsgs && echo -n "Starting ${ms} moused"
 	/usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg}
+	check_startmsgs && echo '.'
 
 	mousechar_arg=
 	case ${mousechar_start} in

Modified: stable/8/etc/rc.d/netif
==============================================================================
--- stable/8/etc/rc.d/netif	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/netif	Fri Oct 16 00:17:09 2009	(r198164)
@@ -141,7 +141,7 @@ network_common()
 			;;
 		esac
 		echo "${_str} Network:${_ok}."
-		if [ -z "${rc_quiet}" ]; then
+		if check_startmsgs; then
 			for ifn in ${_ok}; do
 				/sbin/ifconfig ${ifn}
 			done

Modified: stable/8/etc/rc.d/newsyslog
==============================================================================
--- stable/8/etc/rc.d/newsyslog	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/newsyslog	Fri Oct 16 00:17:09 2009	(r198164)
@@ -17,9 +17,9 @@ stop_cmd=":"
 
 newsyslog_start()
 {
-	[ -z "${rc_quiet}" ] && echo -n "Creating and/or trimming log files:"
+	check_startmsgs && echo -n 'Creating and/or trimming log files'
 	${command} ${rc_flags}
-	[ -z "${rc_quiet}" ] && echo "."
+	check_startmsgs && echo '.'
 }
 
 load_rc_config $name

Modified: stable/8/etc/rc.d/nfsclient
==============================================================================
--- stable/8/etc/rc.d/nfsclient	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/nfsclient	Fri Oct 16 00:17:09 2009	(r198164)
@@ -22,7 +22,8 @@ nfsclient_start()
 	#
 
 	if [ -n "${nfs_access_cache}" ]; then
-		[ -z "${rc_quiet}" ] && echo "NFS access cache time=${nfs_access_cache}"
+		check_startmsgs &&
+			echo "NFS access cache time=${nfs_access_cache}"
 		if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then
 			warn "failed to set access cache timeout"
 		fi

Modified: stable/8/etc/rc.d/pf
==============================================================================
--- stable/8/etc/rc.d/pf	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/pf	Fri Oct 16 00:17:09 2009	(r198164)
@@ -25,19 +25,21 @@ required_modules="pf"
 
 pf_start()
 {
-	[ -z "${rc_quiet}" ] && echo "Enabling pf."
+	check_startmsgs && echo -n 'Enabling pf'
 	$pf_program -F all > /dev/null 2>&1
 	$pf_program -f "$pf_rules" $pf_flags
 	if ! $pf_program -s info | grep -q "Enabled" ; then
 		$pf_program -e
 	fi
+	check_startmsgs && echo '.'
 }
 
 pf_stop()
 {
 	if $pf_program -s info | grep -q "Enabled" ; then
-		[ -z "${rc_quiet}" ] && echo "Disabling pf."
+		echo -n 'Disabling pf'
 		$pf_program -d
+		echo '.'
 	fi
 }
 

Modified: stable/8/etc/rc.d/savecore
==============================================================================
--- stable/8/etc/rc.d/savecore	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.d/savecore	Fri Oct 16 00:17:09 2009	(r198164)
@@ -69,7 +69,7 @@ savecore_start()
 			${crashinfo_program} -d ${dumpdir}
 		fi
 	else
-		[ -z "${rc_quiet}" ] && echo "No core dumps found"
+		check_startmsgs && echo 'No core dumps found.'
 	fi
 }
 

Modified: stable/8/etc/rc.subr
==============================================================================
--- stable/8/etc/rc.subr	Thu Oct 15 23:30:56 2009	(r198163)
+++ stable/8/etc/rc.subr	Fri Oct 16 00:17:09 2009	(r198164)
@@ -372,6 +372,20 @@ wait_for_pids()
 }
 
 #
+# check_startmsgs
+#	If rc_quiet is set (usually as a result of using faststart at
+#	boot time) check if rc_startmsgs is enabled.
+#
+check_startmsgs()
+{
+	if [ -n "$rc_quiet" ]; then
+		checkyesno rc_startmsgs
+	else
+		return 0
+	fi
+}
+
+#
 # run_rc_command argument
 #	Search for argument in the list of supported commands, which is:
 #		"start stop restart rcvar status poll ${extra_commands}"
@@ -680,13 +694,7 @@ run_rc_command()
 
 					# setup the full command to run
 					#
-			_show_startmsgs=1
-			if [ -n "${rc_quiet}" ]; then
-				if ! checkyesno rc_startmsgs; then
-					unset _show_startmsgs
-				fi
-			fi
-			[ -n "$_show_startmsgs" ] && echo "Starting ${name}."
+			check_startmsgs && echo "Starting ${name}."
 			if [ -n "$_chroot" ]; then
 				_doit="\
 ${_nice:+nice -n $_nice }\



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