SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Wed Feb 7 11:56:54 CET 2007


Author: glen
Date: Wed Feb  7 11:56:54 2007
New Revision: 8236

Modified:
   geninitrd/trunk/geninitrd
Log:
- do not use  variable when it's value is something different

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Wed Feb  7 11:56:54 2007
@@ -355,9 +355,11 @@
 }
 
 find_modules_ide() {
-	typeset rootdev
+	local rootblkdev
+
+	# set blockdev for rootfs (hda, sdc, ...)
+	rootblkdev="$(echo "$1" | awk ' { gsub(/\/dev\//,NUL); gsub(/[0-9].*/, NUL); print $0 } ')"
 
-	rootdev="$(echo "$1" | awk ' { gsub(/\/dev\//,NUL); gsub(/[0-9].*/, NUL); print $0 } ')"
 	if [ "$pack_version_long" -lt "002004021" ]; then
 		debug "Finding IDE modules for kernels <= 2.4.20"
 		for n in $PREIDEMODSOLD; do
@@ -382,12 +384,12 @@
 						debug "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/${rootdev}/device/../../vendor -a -f /sys/block/${rootdev}/device/../../device ]; then
-								vendorid="$(awk ' { gsub(/0x/,NUL); print $0 } ' /sys/block/${rootdev}/device/../../vendor)"
-								deviceid="$(awk ' { gsub(/0x/,NUL); print $0 } ' /sys/block/${rootdev}/device/../../device)"
+							if [ -f /sys/block/${rootblkdev}/device/../../vendor -a -f /sys/block/${rootblkdev}/device/../../device ]; then
+								vendorid="$(awk ' { gsub(/0x/,NUL); print $0 } ' /sys/block/${rootblkdev}/device/../../vendor)"
+								deviceid="$(awk ' { gsub(/0x/,NUL); print $0 } ' /sys/block/${rootblkdev}/device/../../device)"
 								searchpciid="${vendorid}${deviceid}"
-							elif [ -f /proc/ide/${rootdev}/../config ]; then
-								searchpciid="$(awk ' /pci bus/ { print $7$9 } ' /proc/ide/${rootdev}/../config)"
+							elif [ -f /proc/ide/${rootblkdev}/../config ]; then
+								searchpciid="$(awk ' /pci bus/ { print $7$9 } ' /proc/ide/${rootblkdev}/../config)"
 							fi
 						fi
 


More information about the pld-cvs-commit mailing list