[PC-BSD Commits] r2581 - pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts

svn at pcbsd.org svn at pcbsd.org
Tue Aug 12 11:47:06 PDT 2008


Author: kris
Date: 2008-08-12 11:47:06 -0700 (Tue, 12 Aug 2008)
New Revision: 2581

Modified:
   pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.FindDisk.sh
Log:

Redesigned the PCBSD.FindDisk.sh script, so that it traverses the /dev
directory looking for valid disk drives to install onto. This should help
make it more reliable in identifying disks, instead of relying on /var/run/dmesg.boot which may not always be dependable. 




Modified: pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.FindDisk.sh
===================================================================
--- pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.FindDisk.sh	2008-08-12 15:57:39 UTC (rev 2580)
+++ pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.FindDisk.sh	2008-08-12 18:47:06 UTC (rev 2581)
@@ -5,57 +5,43 @@
 
 FOUND="0"
 
-# Check for IDE a badly formatted /var/run/dmesg.boot file first
-cat /var/run/dmesg.boot | grep "^md0:" | grep "ad0: " >/dev/null 2>/dev/null
-if [ "$?" = "0" ]
-then
- # Looks like we have a messed up line, clean it up
- VAR="`cat /var/run/dmesg.boot | grep "^md0:" | grep "ad0: " | cut -d ":" -f 3`"
+# Create our device listing
+ls /dev/ > /tmp/devlist
 
- # Make sure this line isn't already in the file
- cat /var/run/dmesg.boot | grep "^ad0: " >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
-   echo "ad0:${VAR}" >>/var/run/dmesg.boot
- fi
-fi
+# Remove any old devlist.new file
+rm /tmp/devlist.new >/dev/null 2>/dev/null
 
-# Check for SCSI in a badly formatted /var/run/dmesg.boot file first
-cat /var/run/dmesg.boot | grep "^md0:" | grep "da0: " >/dev/null 2>/dev/null
-if [ "$?" = "0" ]
-then
- # Looks like we have a messed up line, clean it up
- VAR="`cat /var/run/dmesg.boot | grep "^md0:" | grep "da0: " | cut -d ":" -f 3`"
- 
- # Make sure this line isn't already in the file
- cat /var/run/dmesg.boot | grep "^da0: " >/dev/null 2>/dev/null
- if [ "$?" != "0" ]
- then
-   echo "da0:${VAR}" >>/var/run/dmesg.boot
- fi
-fi
+# Loop through the list and add a : to the end of each dev
+while read line
+do
+   echo "${line}:" >> /tmp/devlist.new
+done < /tmp/devlist
 
+# Move our fixed list over to the valid list
+mv /tmp/devlist.new /tmp/devlist
 
-for i in `egrep "^(ad|aacd|mlxd|mlyd|amrd|idad|twed|da|ar|ips|)[0-9]:" /var/run/dmesg.boot | cut -d':' -f1 | sort | uniq`
+# Now loop through these devices, and list the disk drives
+for i in `egrep "^(ad|aacd|mlxd|mlyd|amrd|idad|twed|da|ar|ips|)[0-9]:" /tmp/devlist | sort | uniq`
 do
-  LN="`cat /var/run/dmesg.boot | grep ^$i | grep -v "MB/s" | grep MB`" >/dev/null
-  echo ${LN}
-  fdisk /dev/${i} >/tmp/${i}
-  FOUND="1"
-done
 
-#If we couldn't find anything in the dmesg file, look for devices instead
-if [ "${FOUND}" = "0" ]
-then
-  if [ -e "/dev/ad0" ]
+  # Get the raw device name, no :
+  DEV="`echo ${i} | cut -d ':' -f 1`"
+  
+  # Check the dmesg output for some more info about this device
+  dmesg | grep ^$DEV: | grep '<' | grep '>' >/dev/null 2>/dev/null
+  if [ "$?" = "0" ]
   then
-     echo "ad0: XXXXXXMB <Unprobed IDE Disk>"
-     fdisk /dev/ad0 >/tmp/ad0  
+     LN="`dmesg | grep ^${DEV}: | grep '<' | grep '>'`"
+     NEWLINE="`echo ${LN} | cut -d ':' -f 2`"
+  else
+     NEWLINE="<Unknown Device>"
   fi
-  if [ -e "/dev/da0" ]
-  then
-     echo "ad0: XXXXXXMB <Unprobed SCSI Disk>"
-     fdisk /dev/ad0 >/tmp/ad0  
-  fi
-fi
 
+  # Echo out the found line for PCInstall to display
+  echo "${DEV}: ${NEWLINE}"
+
+  # Get the fdisk output to be read by PCInstall next
+  fdisk /dev/${DEV} >/tmp/${DEV}
+
+done
+



More information about the Commits mailing list