[readonly/geninitrd: 521/1068] msg->warn. Little tweaks.

draenog draenog at pld-linux.org
Sat Nov 2 19:56:12 CET 2013


commit f4010f7f93dcff7abafb675751f7feaa890e6fcd
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Nov 7 12:07:34 2007 +0000

    msg->warn. Little tweaks.
    
    svn-id: @9009

 geninitrd | 83 +++++++++++++++++++++++++++------------------------------------
 1 file changed, 35 insertions(+), 48 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 3faeaaa..d1fe452 100755
--- a/geninitrd
+++ b/geninitrd
@@ -99,24 +99,21 @@ usage() {
 }
 
 msg() {
-	local opt=""
-	case "$1" in
-		-n)
-			opt="$opt -n"
-			shift
-			;;
-	esac
-	echo $opt >&2 "$PROGRAM: $*"
+	echo "$PROGRAM: $*"
+}
+
+warn() {
+	msg "$*" >&2
 }
 
 debug() {
-	[ -n "$verbose" ] && msg "$*"
+	[ -n "$verbose" ] && warn "$*"
 }
 
 # aborts program abnormally
 die() {
 	local rc=${2:-1}
-	msg "ERROR: $1"
+	warn "ERROR: $1"
 	exit $rc
 }
 
@@ -249,7 +246,7 @@ busybox_applet() {
 		if [ -z "$have" ]; then
 			have=$(echo "$busybox_functions" | egrep -c "( |^)$applet(,|$)")
 			if [ "$have" = 0 ]; then
-				msg "This setup requires busybox-initrd compiled with applet '$applet' support"
+				warn "This setup requires busybox-initrd compiled with applet '$applet' support"
 				err=1
 			fi
 			eval busybox_have_$applet=$have
@@ -298,12 +295,12 @@ BEGIN { here = 0 }
 
 	if [ "$mods" = "" ]; then
 		if [ "$1" != silent ]; then
-			msg "$origmodule: module not found in $depfile"
+			warn "$origmodule: module not found in $depfile"
 		fi
 		if ! is_no "$EXIT_IF_MISSING"; then
 			exit 1
 		else
-			msg "If $origmodule isn't compiled in kernel then this initrd may not start your system."
+			warn "If $origmodule isn't compiled in kernel then this initrd may not start your system."
 		fi
 	fi
 
@@ -520,7 +517,7 @@ find_modules_md() {
 			findmodule "linear"
 			;;
 		*)
-			msg >&2 "raid level $number (in mdadm config) not recognized"
+			warn "raid level $number (in mdadm config) not recognized"
 			;;
 		esac
 	else
@@ -658,7 +655,7 @@ find_modules_ide() {
 _check_lvm() {
 	local node="$1"
 	if [ ! -e "$node" ]; then
-		msg >&2 "WARNING: check_lvm(): node $node doesn't exist!"
+		warn "WARNING: check_lvm(): node $node doesn't exist!"
 		return 1
 	fi
 
@@ -778,8 +775,8 @@ find_modules_for_devpath() {
 		findmodule "-ipv4"
 		findmodule "nfs"
 		have_nfs=yes
-		msg "Remember to use \`root=/dev/ram0 init=/linuxrc' when starting kernel"
-		msg "or you will have problems like init(xx) being child process of swapper(1)."
+		warn "Remember to use \`root=/dev/ram0 init=/linuxrc' when starting kernel"
+		warn "or you will have problems like init(xx) being child process of swapper(1)."
 		return
 	fi
 
@@ -955,17 +952,7 @@ modules_add_linuxrc() {
 		firmware_var="$(eval echo \$MODULE_${generic_module}_FIRMWARE)"
 
 		if [ -n "$verbose" ]; then
-			msg -n "Loading module [$module] "
-			if [ -n "$options" ]; then
-				msg -n "with options [$options]"
-			else
-				msg -n "without options"
-			fi
-			if [ -n "$sleep_var" ]; then
-				msg " and $sleep_var usleep."
-			else
-				msg "."
-			fi
+			warn "Loading module [$module]${options:+ with options [$options]}${options:- without options}${sleep_var:+ and $sleep_var usleep}."
 		fi
 
 		if [ -n "$firmware_var" ]; then
@@ -1094,10 +1081,10 @@ initrd_gen_bootsplash() {
 
 	debug "Generating bootsplash"
 	if [ ! -x /bin/splash.bin ]; then
-		msg "Failed to execute /bin/splash.bin. Is bootsplash package installed?"
+		warn "Failed to execute /bin/splash.bin. Is bootsplash package installed?"
 	elif [ -z "$THEME" ]; then
-		msg "Please configure your /etc/sysconfig/bootsplash first."
-		msg "Generating bootsplashes skipped."
+		warn "Please configure your /etc/sysconfig/bootsplash first."
+		warn "Generating bootsplashes skipped."
 	else
 		if [ -n "$BOOT_SPLASH_RESOLUTIONS" ]; then
 			for res in $BOOT_SPLASH_RESOLUTIONS; do
@@ -1105,12 +1092,12 @@ initrd_gen_bootsplash() {
 					/bin/splash.bin -s -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" >> "$target" && \
 					debug "Added $res $THEME theme to initrd."
 				else
-					msg "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg doesn't exist, skipped"
+					warn "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg doesn't exist, skipped"
 				fi
 			done
 		else
-			msg "No BOOT_SPLASH_RESOLUTIONS specified in /etc/sysconfig/bootsplash."
-			msg "Not adding bootsplash to initrd."
+			warn "No BOOT_SPLASH_RESOLUTIONS specified in /etc/sysconfig/bootsplash."
+			warn "Not adding bootsplash to initrd."
 		fi
 	fi
 }
@@ -1119,19 +1106,19 @@ initrd_gen_fbsplash() {
 	debug "Generating fbsplash"
 
 	if [ ! -x /usr/bin/splash_geninitramfs ]; then
-		msg "Failed to execute /usr/bin/splash_geninitramfs. Is splashutils package installed?"
+		warn "Failed to execute /usr/bin/splash_geninitramfs. Is splashutils package installed?"
 		return
 	fi
 
 	if [ -z "$SPLASH_THEME" ]; then
-		msg "Please configure your /etc/sysconfig/fbsplash first."
-		msg "Generating fbsplashes skipped."
+		warn "Please configure your /etc/sysconfig/fbsplash first."
+		warn "Generating fbsplashes skipped."
 		return
 	fi
 
 	if [ -z "$FB_SPLASH_RESOLUTIONS" ]; then
-		msg "No FB_SPLASH_RESOLUTIONS specified in /etc/sysconfig/fbsplash."
-		msg "Not adding fbsplash to initramfs."
+		warn "No FB_SPLASH_RESOLUTIONS specified in /etc/sysconfig/fbsplash."
+		warn "Not adding fbsplash to initramfs."
 		return
 	fi
 
@@ -1140,7 +1127,7 @@ initrd_gen_fbsplash() {
 			/usr/bin/splash_geninitramfs -c $DESTDIR -r $res $SPLASH_THEME && \
 			debug "Added $res $SPLASH_THEME theme to initramfs."
 		else
-			msg "/etc/splash/$SPLASH_THEME/$res.cfg doesn't exist, skipped"
+			warn "/etc/splash/$SPLASH_THEME/$res.cfg doesn't exist, skipped"
 		fi
 	done
 }
@@ -1412,7 +1399,7 @@ fi
 # backwards compatible
 if [ "$USE_SUSPEND2" ]; then
 	USE_TUXONICE=$USE_SUSPEND2
-	msg "USE_SUSPEND2 is deprecated, use USE_TUXONICE now instead."
+	warn "USE_SUSPEND2 is deprecated, use USE_TUXONICE now instead."
 fi
 
 while [ $# -gt 0 ]; do
@@ -1517,11 +1504,11 @@ while [ $# -gt 0 ]; do
 		shift
 		;;
 	--fs=*)
-		msg "Warning: --fs option is obsoleted. Use --initrdfs instead"
+		warn "Warning: --fs option is obsoleted. Use --initrdfs instead"
 		INITRDFS=${1#--fs=}
 		;;
 	--fs)
-		msg "Warning: --fs option is obsoleted. Use --initrdfs instead"
+		warn "Warning: --fs option is obsoleted. Use --initrdfs instead"
 		INITRDFS=$2
 		shift
 		;;
@@ -1557,7 +1544,7 @@ if [ -z "$target" -o -z "$kernel" ]; then
 fi
 
 if [ ! -f /boot/vmlinuz-"$kernel" ]; then
-	msg "/boot/vmlinuz-$kernel doesn't exist, is your /boot mounted?"
+	warn "/boot/vmlinuz-$kernel doesn't exist, is your /boot mounted?"
 fi
 
 pack_version="`echo "$kernel"|awk -F. '{print sprintf("%03d%03d",$1,$2)}'`"
@@ -1572,7 +1559,7 @@ if [ -z "$INITRDFS" ]; then
 			INITRDFS="rom"
 		fi
 	else
-		msg "Warning: FS configuration options is obsoleted. Use INITRDFS instead"
+		warn "Warning: FS configuration options is obsoleted. Use INITRDFS instead"
 		INITRDFS="$FS"
 	fi
 fi
@@ -1652,7 +1639,7 @@ if is_yes "$FB_SPLASH"; then
 fi
 
 if [ ! -f /proc/mounts ]; then
-	msg "WARNING: /proc filesystem not mounted, may cause wrong results or failure."
+	warn "WARNING: /proc filesystem not mounted, may cause wrong results or failure."
 fi
 
 if [ -d /usr/lib64 ]; then
@@ -1906,7 +1893,7 @@ case "$INITRDFS" in
 		IMAGESIZE=$(du -ks $DESTDIR | awk '{print int(($1+1023+512)/1024)*1024}')
 		debug 	"ext2 image size: $IMAGESIZE ($DESTDIR)"
 		if [ "$IMAGESIZE" -gt 4096 ]; then
-			msg "$PROGRAM: Your image size is larger than 4096, Be sure to boot kernel with ramdisk_size=$IMAGESIZE!"
+			warn "$PROGRAM: Your image size is larger than 4096, Be sure to boot kernel with ramdisk_size=$IMAGESIZE!"
 		fi
 
 		debug "Creating ext2 image $IMAGE"
@@ -1932,7 +1919,7 @@ case "$INITRDFS" in
 		IMAGESIZE=$(stat -c %s $IMAGE | awk '{print int((($1/1024)+1023)/1024)*1024}')
 		debug "Image size for romfs: ${IMAGESIZE}KiB ($IMAGE)"
 		if [ "$IMAGESIZE" -gt 4096 ]; then
-			msg "$PROGRAM: Your image size is larger than 4096, Be sure to boot kernel with ramdisk_size=$IMAGESIZE!"
+			warn "$PROGRAM: Your image size is larger than 4096, Be sure to boot kernel with ramdisk_size=$IMAGESIZE!"
 		fi
 		;;
 	cram|cramfs)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/147754ca159d40ca5eb541074dc043d8cbd92090



More information about the pld-cvs-commit mailing list