SVN: geninitrd/trunk: geninitrd mod-blkid.sh mod-bootsplash.sh mod-condecor.sh mod-fbsplash.sh mod-i...

glen glen at pld-linux.org
Tue Apr 17 15:45:41 CEST 2012


Author: glen
Date: Tue Apr 17 15:45:41 2012
New Revision: 12550

Modified:
   geninitrd/trunk/geninitrd
   geninitrd/trunk/mod-blkid.sh
   geninitrd/trunk/mod-bootsplash.sh
   geninitrd/trunk/mod-condecor.sh
   geninitrd/trunk/mod-fbsplash.sh
   geninitrd/trunk/mod-ide.sh
   geninitrd/trunk/mod-luks.sh
   geninitrd/trunk/mod-lvm.sh
   geninitrd/trunk/mod-md.sh
   geninitrd/trunk/mod-multipath.sh
   geninitrd/trunk/mod-nfs.sh
   geninitrd/trunk/mod-sata.sh
   geninitrd/trunk/mod-scsi.sh
   geninitrd/trunk/mod-suspend.sh
   geninitrd/trunk/mod-udev.sh
   geninitrd/trunk/mod-usbkbd.sh
   geninitrd/trunk/mod-uvesafb.sh
Log:
add debug and verbose output

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Tue Apr 17 15:45:41 2012
@@ -79,8 +79,12 @@
 	msg "WARNING: $*" >&2
 }
 
+verbose() {
+	[ x"$verbose" = x"-v" ] && msg "$*" >&3
+}
+
 debug() {
-	[ -n "$verbose" ] && msg "$*" >&3
+	[ x"$verbose" = x"-v -v" ] && msg "$*" >&3
 }
 
 # aborts program abnormally
@@ -96,7 +100,7 @@
 	for x in "$@"; do
 		if [ -x "$x" ]; then
 			echo $x
-			debug "find_tool: found $x"
+			verbose "find_tool: found $x"
 			return 0
 		fi
 	done
@@ -402,8 +406,11 @@
 	local dest=$1
 	set -- $src
 	local parentDir=$(dirname $DESTDIR$dest)
-	[ ! -d "$parentDir" ] && (debug "+ mkdir -p $parentDir"; mkdir -p $parentDir)
-	debug "+ cp $* $DESTDIR$dest"
+	if [ ! -d "$parentDir" ]; then
+		verbose "+ mkdir -p $parentDir"
+		mkdir -p $parentDir
+	fi
+	verbose "+ cp $* $DESTDIR$dest"
 	cp -HR "$@" "$DESTDIR$dest"
 }
 
@@ -457,7 +464,7 @@
 		if [ ! -e $DESTDIR$libdir ]; then
 			libdir=$(dirname "$libdir")
 			inst_d $libdir
-			debug "+ ln -s /$_lib $DESTDIR$libdir"
+			verbose "+ ln -s /$_lib $DESTDIR$libdir"
 			ln -s /$_lib $DESTDIR$libdir
 		fi
 	fi
@@ -515,7 +522,7 @@
 		devpath=$(readlink -f "$devpath")
 	fi
 
-	debug "Finding modules for device path $devpath"
+	verbose "Finding modules for device path $devpath"
 
 	if is_luks "$devpath"; then
 		find_modules_luks "$devpath"
@@ -631,7 +638,7 @@
 	local module="$1"
 	local firmware_files="$2"
 
-	debug "Adding Firmwares ($firmware_files) to initrd for module $module"
+	verbose "Adding Firmwares ($firmware_files) to initrd for module $module"
 	# firmware not yet installed
 	if [ ! -f "$DESTDIR/lib/firmware/firmware.sh" ]; then
 		inst_d /lib/firmware
@@ -698,7 +705,7 @@
 			options="scan=sync $options"
 		fi
 
-		if [ -n "$verbose" ]; then
+		if [ x"$verbose" = x"-v" ]; then
 			s=""
 			if [ "$options" ]; then
 				s="$s with options [$options]"
@@ -706,7 +713,7 @@
 			if [ "$usleep" ]; then
 				s="$s and $usleep usleep"
 			fi
-			debug "Loading module [$module]$s"
+			verbose "Loading module [$module]$s"
 		fi
 
 		if [ -n "$firmware" ]; then
@@ -757,7 +764,7 @@
 
 
 initrd_gen_setrootdev() {
-	debug "Adding rootfs finding based on kernel cmdline root= option support."
+	verbose "Adding rootfs finding based on kernel cmdline root= option support."
 	busybox_applet ls
 	debug "Current /proc/partitions:\n$(sed -e 's,^,> ,' /proc/partitions)"
 	add_linuxrc <<-'EOF'
@@ -898,7 +905,7 @@
 		compressors="$mode"
 	fi
 
-	debug "finding compressor: $compressors (via $mode)"
+	verbose "finding compressor: $compressors (via $mode)"
 	# check for compressor validity
 	local c prog map=/boot/System.map-$kernel
 	for c in $compressors; do
@@ -938,7 +945,7 @@
 		fi
 	done
 
-	debug "using gzip for compressor (fallback)"
+	verbose "using gzip for compressor (fallback)"
 	echo gzip
 }
 
@@ -1072,7 +1079,11 @@
 		exit 0
 		;;
 	-v)
-		verbose=-v
+		if [ x"$verbose" = x"-v" ]; then
+			verbose="-v -v"
+		else
+			verbose="-v"
+		fi
 		exec 3>&1
 		;;
 	--compress)
@@ -1158,7 +1169,7 @@
 kernel_version=$(echo "$kernel" | awk -F. '{gsub(/[_-].*/, "", $0); print sprintf("%03d%03d",$1,$2)}')
 kernel_version_long=$(echo "$kernel" | awk -F. '{gsub(/[_-].*/, "", $0); print sprintf("%03d%03d%03d",$1,$2,$3)}')
 
-debug "# $GENINITRD_RCSID (geninitrd)"
+verbose "# $GENINITRD_RCSID (geninitrd)"
 debug "Using _lib: $_lib"
 debug "Using initrd_dir: $initrd_dir"
 
@@ -1256,7 +1267,7 @@
 fi
 
 find_root "$fstab" || exit
-debug "Using $rootdev as device for rootfs"
+verbose "Using $rootdev as device for rootfs"
 
 find_modules_for_devpath "$rootdev"
 
@@ -1279,11 +1290,11 @@
 find_modules_fbsplash
 
 if [ -n "$ifneeded" -a -z "$MODULES" ]; then
-	debug "No modules are needed -- not building initrd image."
+	verbose "No modules are needed -- not building initrd image."
 	exit 0
 fi
 
-debug "Building initrd..."
+verbose "Building initrd..."
 DESTDIR=$(mktemp -d -t initrd.XXXXXX) || die "mktemp failed"
 RCFILE="$DESTDIR/linuxrc"
 > "$RCFILE"
@@ -1459,9 +1470,9 @@
 IMAGE=$(mktemp -t initrd.img-XXXXXX) || die "mktemp failed"
 
 IMAGESIZE=$(du -ks $DESTDIR | awk '{print int(($1+1023+512)/1024)*1024}')
-debug "image size: $IMAGESIZE KiB ($DESTDIR)"
+verbose "image size: $IMAGESIZE KiB ($DESTDIR)"
 
-debug "Creating $INITRDFS image $IMAGE"
+verbose "Creating $INITRDFS image $IMAGE"
 case "$INITRDFS" in
   ext2)
 	dd if=/dev/zero of="$IMAGE" bs=1k count="$IMAGESIZE" 2> /dev/null
@@ -1506,7 +1517,7 @@
 
 if ! is_no "$COMPRESS"; then
 	compressor=$(find_compressor "$COMPRESS")
-	debug "Compressing $target with $compressor"
+	verbose "Compressing $target with $compressor"
 
 	# TODO: the image name (specified from kernel.spec) already contains
 	# extension, which is .gz most of the time.

Modified: geninitrd/trunk/mod-blkid.sh
==============================================================================
--- geninitrd/trunk/mod-blkid.sh	(original)
+++ geninitrd/trunk/mod-blkid.sh	Tue Apr 17 15:45:41 2012
@@ -22,7 +22,7 @@
 	if ! is_yes "$USE_BLKID"; then
 		return
 	fi
-	debug "Adding BLKID support to initrd"
+	verbose "Adding BLKID support to initrd"
 
 	inst_exec $blkid /bin/blkid
 	initrd_gen_devices

Modified: geninitrd/trunk/mod-bootsplash.sh
==============================================================================
--- geninitrd/trunk/mod-bootsplash.sh	(original)
+++ geninitrd/trunk/mod-bootsplash.sh	Tue Apr 17 15:45:41 2012
@@ -28,7 +28,7 @@
 	fi
 	local target="$1"
 
-	debug "Generating bootsplash"
+	verbose "Generating bootsplash"
 
 	if [ ! -x /bin/splash.bin ]; then
 		warn "Failed to execute /bin/splash.bin. Is bootsplash package installed?"
@@ -54,7 +54,7 @@
 	for res in $BOOT_SPLASH_RESOLUTIONS; do
 		if [ -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" ]; then
 			$bootsplash_geninitramfs -s -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" >> "$target" && \
-			debug "Added $res $THEME theme to initrd."
+			verbose "Added $res $THEME theme to initrd."
 		else
 			warn "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg doesn't exist, skipped"
 		fi

Modified: geninitrd/trunk/mod-condecor.sh
==============================================================================
--- geninitrd/trunk/mod-condecor.sh	(original)
+++ geninitrd/trunk/mod-condecor.sh	Tue Apr 17 15:45:41 2012
@@ -26,7 +26,7 @@
 	if ! is_yes "$FB_CON_DECOR"; then
 		return
 	fi
-	debug "Generating fbcondecor"
+	verbose "Generating fbcondecor"
 
 	if [ -r /etc/sysconfig/splash ]; then
 		. /etc/sysconfig/splash
@@ -48,7 +48,7 @@
 	for res in $FB_SPLASH_RESOLUTIONS; do
 		if [ -f "/etc/splash/$SPLASH_THEME/$res.cfg" ]; then
 			$condecor_geninitramfs -c $DESTDIR -r $res $SPLASH_THEME && \
-			debug "Added $res $SPLASH_THEME theme to initramfs."
+			verbose "Added $res $SPLASH_THEME theme to initramfs."
 		else
 			warn "/etc/splash/$SPLASH_THEME/$res.cfg doesn't exist, skipped"
 		fi

Modified: geninitrd/trunk/mod-fbsplash.sh
==============================================================================
--- geninitrd/trunk/mod-fbsplash.sh	(original)
+++ geninitrd/trunk/mod-fbsplash.sh	Tue Apr 17 15:45:41 2012
@@ -42,7 +42,7 @@
 	if ! is_yes "$FB_SPLASH"; then
 		return
 	fi
-	debug "Generating fbsplash"
+	verbose "Generating fbsplash"
 
 	if [ -r /etc/sysconfig/fbsplash ]; then
 		. /etc/sysconfig/fbsplash
@@ -64,7 +64,7 @@
 	for res in $FB_SPLASH_RESOLUTIONS; do
 		if [ -f "/etc/splash/$SPLASH_THEME/$res.cfg" ]; then
 			$fbsplash_geninitramfs -c $DESTDIR -r $res $SPLASH_THEME && \
-			debug "Added $res $SPLASH_THEME theme to initramfs."
+			verbose "Added $res $SPLASH_THEME theme to initramfs."
 		else
 			warn "/etc/splash/$SPLASH_THEME/$res.cfg doesn't exist, skipped"
 		fi

Modified: geninitrd/trunk/mod-ide.sh
==============================================================================
--- geninitrd/trunk/mod-ide.sh	(original)
+++ geninitrd/trunk/mod-ide.sh	Tue Apr 17 15:45:41 2012
@@ -42,7 +42,7 @@
 
 	local n
 	if [ "$kernel_version_long" -lt "002004021" ]; then
-		debug "Finding IDE modules for kernels <= 2.4.20"
+		verbose "Finding IDE modules for kernels <= 2.4.20"
 		for n in $PREIDEMODSOLD; do
 			find_module "$n"
 		done
@@ -50,7 +50,7 @@
 		local tryauto=1
 		for n in $PREIDEMODS; do
 			if [ "X$n" = "Xunknown" ]; then
-				debug "Finding IDE modules using ide_hostadapter"
+				verbose "Finding IDE modules using ide_hostadapter"
 				local mod idemodules=$(modprobe_conf | awk '/ide_hostadapter/ { print $3 }')
 				for mod in $idemodules; do
 					tryauto=0
@@ -60,7 +60,7 @@
 				if [ "$tryauto" -eq 1 ]; then
 					# If tryauto {{{
 					if [ -r /usr/share/pci-database/ide.pci -a -r /proc/bus/pci/devices ]; then
-						debug "Finding IDE modules using PCI ID database"
+						verbose "Finding IDE modules using PCI ID database"
 						# Finding IDE modules using PCI ID database {{{
 						if is_yes "${ide_only_root}"; then
 							if [ -f /sys/block/${rootblkdev}/device/../../vendor -a -f /sys/block/${rootblkdev}/device/../../device ]; then

Modified: geninitrd/trunk/mod-luks.sh
==============================================================================
--- geninitrd/trunk/mod-luks.sh	(original)
+++ geninitrd/trunk/mod-luks.sh	Tue Apr 17 15:45:41 2012
@@ -34,7 +34,7 @@
 
 	local dev dm_name=${node#/dev/mapper/}
 	if [ "$node" = "$dm_name" ]; then
-		debug "is_luks: $node is not device mapper name"
+		verbose "is_luks: $node is not device mapper name"
 		return 1
 	fi
 
@@ -47,9 +47,9 @@
 	fi
 
 	if [ $rc = 0 ]; then
-		debug "is_luks: $node is cryptsetup luks"
+		verbose "is_luks: $node is cryptsetup luks"
 	else
-		debug "is_luks: $node is not cryptsetup luks"
+		verbose "is_luks: $node is not cryptsetup luks"
 	fi
 	return $rc
 }
@@ -95,7 +95,7 @@
 	initrd_gen_devices
 	# TODO: 'udevadm settle' is called by lukssetup, is udev optional?
 
-	debug "luks: process /etc/crypttab $LUKSNAME"
+	verbose "luks: process /etc/crypttab $LUKSNAME"
 	luks_crypttab $LUKSNAME
 }
 
@@ -144,7 +144,7 @@
 				inst $key $keyfile
 			fi
 
-			debug "+ cryptsetup ${keyfile:+-d $keyfile} luksOpen '$src' '$dst'"
+			verbose "+ cryptsetup ${keyfile:+-d $keyfile} luksOpen '$src' '$dst'"
 			add_linuxrc <<-EOF
 			# cryptsetup can be called twice and in case on crypt on lvm only second
 			# will succeed because there will be no src device in first cryptsetup call

Modified: geninitrd/trunk/mod-lvm.sh
==============================================================================
--- geninitrd/trunk/mod-lvm.sh	(original)
+++ geninitrd/trunk/mod-lvm.sh	Tue Apr 17 15:45:41 2012
@@ -83,14 +83,14 @@
 find_modules_lvm() {
 	local devpath="$1"
 
-	debug "LVM: $devpath is LVM node"
+	verbose "LVM: $devpath is LVM node"
 
 	local vg=$(find_lvm_vg "$devpath")
-	debug "LVM VG for $devpath: $vg"
+	verbose "LVM VG for $devpath: $vg"
 	LVM_VGVOLUMES=$(echo $LVM_VGVOLUMES $vg | tr ' ' '\n' | sort -u)
 
 	local pv=$(find_lvm_pv "$vg")
-	debug "LVM PV for $vg: $pv"
+	verbose "LVM PV for $vg: $pv"
 	PVDEVICES=$(echo $PVDEVICES $pv | tr ' ' '\n' | sort -u)
 
 	if [ -n "$PVDEVICES" ]; then
@@ -110,7 +110,7 @@
 		die "LVM version $LVMTOOLSVERSION is not supported."
 	fi
 
-	debug "LVM v$LVMTOOLSVERSION enabled"
+	verbose "LVM v$LVMTOOLSVERSION enabled"
 	have_lvm=yes
 }
 
@@ -122,7 +122,7 @@
 		return
 	fi
 
-	debug "Adding LVM support to initrd"
+	verbose "Adding LVM support to initrd"
 	inst_d /tmp /newroot
 	inst_exec $lvm /bin/lvm.static
 
@@ -170,7 +170,7 @@
 			echo '	filter = [' >> "$DESTDIR/etc/lvm.conf"
 			local dev
 			for dev in $lvm_ignore_devices; do
-				debug "LVM v2: ignore device $dev"
+				verbose "LVM v2: ignore device $dev"
 				printf '  "r|^%s.*|",\n' $dev
 			done >> "$DESTDIR/etc/lvm.conf"
 			echo ']' >> "$DESTDIR/etc/lvm.conf"

Modified: geninitrd/trunk/mod-md.sh
==============================================================================
--- geninitrd/trunk/mod-md.sh	(original)
+++ geninitrd/trunk/mod-md.sh	Tue Apr 17 15:45:41 2012
@@ -46,7 +46,7 @@
 	local found raidlevel
 
 	if [ -f /etc/mdadm.conf ]; then
-		debug "Finding RAID details using mdadm for rootdev=$1"
+		verbose "Finding RAID details using mdadm for rootdev=$1"
 		eval `($mdadm -v --examine --scan --config=/etc/mdadm.conf 2> /dev/null;$mdadm -v --detail --scan --config=/etc/mdadm.conf 2> /dev/null) | awk -v rootdev="$1" '
 		BEGIN {
 			found = "no";
@@ -119,7 +119,7 @@
 		die "RAID devices not found for \"$1\", check your configuration!"
 	fi
 
-	debug "md: found rootdev=$1 on device $rootdev_new with devices list ${dev_list}"
+	verbose "md: found rootdev=$1 on device $rootdev_new with devices list ${dev_list}"
 
 	rootdev_nr=$(( $rootdev_nr + 1 ))
 	eval "rootdev${rootdev_nr}=\"$rootdev_new\""
@@ -137,7 +137,7 @@
 	if ! is_yes "$have_md"; then
 		return
 	fi
-	debug "Setting up mdadm..."
+	verbose "Setting up mdadm..."
 
 	inst_exec $mdassemble /bin/mdassemble
 
@@ -161,7 +161,7 @@
 	for nr in `seq 1 $rootdev_nr`; do
 		eval cr_rootdev="\$rootdev${nr}"
 		eval cr_dev_list="\$dev_list${nr}"
-		debug echo "Setting up array ($cr_rootdev = $cr_dev_list)"
+		verbose "Setting up array ($cr_rootdev = $cr_dev_list)"
 
 		[ "$cr_rootdev" = "/dev/md0" ] && do_md0=0
 

Modified: geninitrd/trunk/mod-multipath.sh
==============================================================================
--- geninitrd/trunk/mod-multipath.sh	(original)
+++ geninitrd/trunk/mod-multipath.sh	Tue Apr 17 15:45:41 2012
@@ -78,7 +78,7 @@
 		return 1
 	fi
 
-	debug "Finding modules for dm-multipath (WWID=$MPATH_WWID)"
+	verbose "Finding modules for dm-multipath (WWID=$MPATH_WWID)"
 	have_multipath=yes
 
 	local p list

Modified: geninitrd/trunk/mod-nfs.sh
==============================================================================
--- geninitrd/trunk/mod-nfs.sh	(original)
+++ geninitrd/trunk/mod-nfs.sh	Tue Apr 17 15:45:41 2012
@@ -56,7 +56,7 @@
 
 	# use root=/dev/ram0 init=/linuxrc when starting kernel or you will
 	# have problems like init(XX) being child process of swapper(1).
-	debug "Adding rootfs on NFS support to initrd (dhcp)"
+	verbose "Adding rootfs on NFS support to initrd (dhcp)"
 	mknod "$DESTDIR/dev/urandom" c 1 9
 	mkdir "$DESTDIR/newroot"
 	add_linuxrc <<-'EOF'

Modified: geninitrd/trunk/mod-sata.sh
==============================================================================
--- geninitrd/trunk/mod-sata.sh	(original)
+++ geninitrd/trunk/mod-sata.sh	Tue Apr 17 15:45:41 2012
@@ -4,7 +4,7 @@
 # geninitrd mod: sata
 
 find_modules_sata() {
-	debug "Finding SATA modules (class=0x0106)"
+	verbose "Finding SATA modules (class=0x0106)"
 
 	# Classes (we want only 0106)
 	# http://pci-ids.ucw.cz/read/PD/01

Modified: geninitrd/trunk/mod-scsi.sh
==============================================================================
--- geninitrd/trunk/mod-scsi.sh	(original)
+++ geninitrd/trunk/mod-scsi.sh	Tue Apr 17 15:45:41 2012
@@ -39,7 +39,7 @@
 	local n
 	for n in $PRESCSIMODS; do
 		if [ "X$n" = "Xunknown" ]; then
-			debug "Finding SCSI modules using scsi_hostadapter"
+			verbose "Finding SCSI modules using scsi_hostadapter"
 			local mod scsimodules=$(modprobe_conf | awk '/scsi_hostadapter/ { print $3 }')
 			for mod in $scsimodules; do
 				# for now allow scsi modules to come from anywhere. There are some

Modified: geninitrd/trunk/mod-suspend.sh
==============================================================================
--- geninitrd/trunk/mod-suspend.sh	(original)
+++ geninitrd/trunk/mod-suspend.sh	Tue Apr 17 15:45:41 2012
@@ -36,7 +36,7 @@
 		# save suspend VG int oseparate var
 		LVM_SUSPENDVG=$LVM_VGVOLUMES
 		LVM_VGVOLUMES=$vgvolumes
-		debug "suspend device is on LVM"
+		verbose "suspend device is on LVM"
 	fi
 }
 
@@ -47,7 +47,7 @@
 		return
 	fi
 
-	debug "Setting up suspend..."
+	verbose "Setting up suspend..."
 
 	mknod $DESTDIR/dev/snapshot c 10 231
 	mkdir -p $DESTDIR${resume_dev%/*}

Modified: geninitrd/trunk/mod-udev.sh
==============================================================================
--- geninitrd/trunk/mod-udev.sh	(original)
+++ geninitrd/trunk/mod-udev.sh	Tue Apr 17 15:45:41 2012
@@ -41,7 +41,7 @@
 # generate initrd fragment
 # @access	public
 initrd_gen_udev() {
-	debug "Setting up udev..."
+	verbose "Setting up udev..."
 
 	inst_d /sbin /etc/udev
 	inst_exec $udevd /sbin/udevd

Modified: geninitrd/trunk/mod-usbkbd.sh
==============================================================================
--- geninitrd/trunk/mod-usbkbd.sh	(original)
+++ geninitrd/trunk/mod-usbkbd.sh	Tue Apr 17 15:45:41 2012
@@ -4,7 +4,7 @@
 # geninitrd mod: usbkbd
 
 find_modules_usbkbd() {
-	debug "Finding USB keyboard modules"
+	verbose "Finding USB keyboard modules"
 
 	if [ "$(echo /sys/class/input/input*)" = "/sys/class/input/input*" ]; then
 		return
@@ -20,9 +20,9 @@
 			if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then
 				module=$(readlink $i/device/driver/module)
 				module=$(basename $module)
-	
+
 				if [ -n "$module" ]; then
-					debug "Found USB Keyboard: $(cat $i/name)"
+					verbose "Found USB Keyboard: $(cat $i/name)"
 					modules="$modules $module"
 				fi
 			fi
@@ -34,7 +34,7 @@
 			module=$(basename $module)
 
 			if [ -n "$module" ]; then
-				debug "Found USB Logitech Unifying Device: $(cat $i/name)"
+				verbose "Found USB Logitech Unifying Device: $(cat $i/name)"
 				modules="$modules $module"
 			fi
 		fi

Modified: geninitrd/trunk/mod-uvesafb.sh
==============================================================================
--- geninitrd/trunk/mod-uvesafb.sh	(original)
+++ geninitrd/trunk/mod-uvesafb.sh	Tue Apr 17 15:45:41 2012
@@ -40,7 +40,7 @@
 		return
 	fi
 
-	debug "initrd_gen_uvesafb"
+	verbose "initrd_gen_uvesafb"
 	mknod $DESTDIR/dev/mem c 1 1
 	mknod $DESTDIR/dev/tty1 c 4 1
 	inst_d /sbin


More information about the pld-cvs-commit mailing list