Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Jan 2008 21:46:42 +0300
From:      Mike Makonnen <mtm@FreeBSD.Org>
To:        freebsd-rc <freebsd-rc@freebsd.org>
Cc:        scottl@freebsd.org, Brooks Davis <brooks@freebsd.org>
Subject:   Re: cvs commit: src/etc rc.subr
Message-ID:  <1201286802.2865.8.camel@mercury>
In-Reply-To: <20080125160412.GA36311@lor.one-eyed-alien.net>
References:  <200801251506.m0PF6Qwf043571@repoman.freebsd.org> <20080125152102.GD6064@submonkey.net> <20080125160412.GA36311@lor.one-eyed-alien.net>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]

On Fri, 2008-01-25 at 10:04 -0600, Brooks Davis wrote:
> On Fri, Jan 25, 2008 at 03:21:02PM +0000, Ceri Davies wrote:
> > On Fri, Jan 25, 2008 at 03:06:26PM +0000, Mike Makonnen wrote:
> > > mtm         2008-01-25 15:06:26 UTC
> > > 
> > >   FreeBSD src repository
> > > 
> > >   Modified files:
> > >     etc                  rc.subr 
> > >   Log:
> > >   If the rc.conf(5) variable for a script is not enabled do not fail
> > >   silently. Display a message that the command wasn't run and make
> > >   possible suggestions for what to do.
> > 
> > Any chance that we could make this behaviour dependent on some other
> > variable (or not do it)?  It's going to make booting look pretty nasty.
> 
> The other option I'd considered was to create a quiet precmd that works like
> force and use quietstart/quitestop for boot.  I've become convinced this is the
> right interactive behavior.
> 
> -- Brooks
> 
> > Ceri
> > 
> > > | @@ -606,6 +606,9 @@ run_rc_command()
> > > |  					#
> > > |  	if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" ]; then
> > > |  		if ! checkyesno ${rcvar}; then
> > > | +			echo -n "Cannot '${rc_arg}' $name. Set ${rcvar} to "
> > > | +			echo -n "YES in /etc/rc.conf or use 'one${rc_arg}' "
> > > | +			echo "instead of '${rc_arg}'."
> > > |  			return 0
> > > |  		fi
> > > |  	fi
> > 

Ok, I went with brooks@'s suggestion and instead implemented a quiet
prefix. In addition, I also made the 'fast' prefix imply 'quiet'.

Something else this buys us is that we now have a knob that we can put a
lot of diagnostic messages behind to "de-clutter" the console during
boot and shutdown.
Patch is attached.

Cheers.
-- 
Mike Makonnen         | GPG-KEY: http://people.freebsd.org/~mtm/mtm.asc
mmakonnen @ gmail.com | AC7B 5672 2D11 F4D0 EBF8 5279 5359 2B82 7CD4 1F55
mtm @ FreeBSD.Org     | FreeBSD - http://www.freebsd.org

[-- Attachment #2 --]
Index: etc/rc
===================================================================
RCS file: /home/ncvs/src/etc/rc,v
retrieving revision 1.340
diff -u -r1.340 rc
--- etc/rc	2 Apr 2007 22:53:06 -0000	1.340
+++ etc/rc	25 Jan 2008 18:02:14 -0000
@@ -56,7 +56,7 @@
 	rc_fast=yes        # run_rc_command(): do fast booting
 else
 	autoboot=no
-	_boot="start"
+	_boot="quietstart"
 fi
 
 dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
Index: etc/rc.subr
===================================================================
RCS file: /home/ncvs/src/etc/rc.subr,v
retrieving revision 1.79
diff -u -r1.79 rc.subr
--- etc/rc.subr	25 Jan 2008 16:44:34 -0000	1.79
+++ etc/rc.subr	25 Jan 2008 18:23:44 -0000
@@ -377,9 +377,10 @@
 #	If argument has a given prefix, then change the operation as follows:
 #		Prefix	Operation
 #		------	---------
-#		fast	Skip the pid check, and set rc_fast=yes
+#		fast	Skip the pid check, and set rc_fast=yes, rc_quiet=yes
 #		force	Set ${rcvar} to YES, and set rc_force=yes
 #		one	Set ${rcvar} to YES
+#		quiet	Don't output some diagnostics, and set rc_quiet=yes
 #
 #	The following globals are used:
 #
@@ -522,6 +523,8 @@
 #
 #	rc_force	Not empty if "force" was provided (q.v.)
 #
+#	rc_quiet	Not empty if "quiet" was provided
+#
 #
 run_rc_command()
 {
@@ -542,6 +545,7 @@
 	fast*)				# "fast" prefix; don't check pid
 		rc_arg=${rc_arg#fast}
 		rc_fast=yes
+		rc_quiet=yes
 		;;
 	force*)				# "force prefix; always run
 		rc_force=yes
@@ -558,6 +562,11 @@
 			eval ${rcvar}=YES
 		fi
 		;;
+	quiet*)				# "quiet" prefix; omit some messages
+		_rc_prefix=quiet
+		rc_arg=${rc_arg#${_rc_prefix}}
+		rc_quiet=yes
+		;;
 	esac
 
 	eval _override_command=\$${name}_program
@@ -606,6 +615,12 @@
 					#
 	if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" ]; then
 		if ! checkyesno ${rcvar}; then
+			if [ -n "${rc_quiet}" ]; then
+				return 0
+			fi
+			echo -n "Cannot '${rc_arg}' $name. Set ${rcvar} to "
+			echo -n "YES in /etc/rc.conf or use 'one${rc_arg}' "
+			echo "instead of '${rc_arg}'."
 			return 0
 		fi
 	fi
Index: etc/rc.d/netif
===================================================================
RCS file: /home/ncvs/src/etc/rc.d/netif,v
retrieving revision 1.24
diff -u -r1.24 netif
--- etc/rc.d/netif	25 Jul 2007 18:08:01 -0000	1.24
+++ etc/rc.d/netif	25 Jan 2008 18:33:06 -0000
@@ -72,7 +72,7 @@
 
 	if [ -f /etc/rc.d/ipfilter ] ; then
 		# Resync ipfilter
-		/etc/rc.d/ipfilter resync
+		/etc/rc.d/ipfilter quietresync
 	fi
 	if [ -f /etc/rc.d/bridge -a -n "$cmdifn" ] ; then
 		/etc/rc.d/bridge start $cmdifn
help

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