SVN: geninitrd/trunk/geninitrd

arekm arekm at pld-linux.org
Wed Nov 7 13:07:34 CET 2007


Author: arekm
Date: Wed Nov  7 13:07:34 2007
New Revision: 9009

Modified:
   geninitrd/trunk/geninitrd
Log:
msg->warn. Little tweaks.

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Wed Nov  7 13:07:34 2007
@@ -99,24 +99,21 @@
 }
 
 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 @@
 		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 @@
 
 	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 @@
 			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 @@
 _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 @@
 		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 @@
 		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 @@
 
 	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 @@
 					/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 @@
 	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 @@
 			/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 @@
 # 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 @@
 		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 @@
 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 @@
 			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 @@
 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 @@
 		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 @@
 		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)


More information about the pld-cvs-commit mailing list