[arch-projects] [initscripts][PATCH 1/2] functions: allow verbose output from status()

Dave Reisner d at falconindy.com
Sun Jan 22 20:40:11 EST 2012


Detect -v as a parameter to status and avoid dumping everything to
/dev/null. Use this to restore error output to modprobe on loading
user-specified modules.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
This might be appropriate in other places as well, but I figure for
now it's definitely a good idea to add it to the modprobe call.

 functions |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/functions b/functions
index aad741a..98a3283 100644
--- a/functions
+++ b/functions
@@ -171,9 +171,14 @@ stat_die() {
 }
 
 status() {
+	[[ $1 = '-v' ]] && { local v=1; shift; }
 	stat_busy "$1"
 	shift
-	"$@" &>/dev/null
+	if (( v )); then
+		"$@"
+	else
+		"$@" &>/dev/null
+	fi
 	local ret=$?
 	(( ret == 0 )) && stat_done || stat_fail
 	return $ret
@@ -354,7 +359,7 @@ udevd_modprobe() {
 
 	# Load modules from the MODULES array defined in rc.conf
 	[[ -f /proc/modules ]] && (( ${#MODULES[*]} )) &&
-		status "Loading User-specified Modules" modprobe -ab "${MODULES[@]}"
+		status -v "Loading User-specified Modules" modprobe -ab "${MODULES[@]}"
 
 	status "Waiting for UDev uevents to be processed" \
 		udevadm settle
-- 
1.7.8.4



More information about the arch-projects mailing list