Changeset 2581
- Timestamp:
- 08/12/08 11:47:06 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pcbsd/trunk/installcd-overlay/usr/local/pcbsd/scripts/PCBSD.FindDisk.sh
r2312 r2581 6 6 FOUND="0" 7 7 8 # Check for IDE a badly formatted /var/run/dmesg.boot file first 9 cat /var/run/dmesg.boot | grep "^md0:" | grep "ad0: " >/dev/null 2>/dev/null 10 if [ "$?" = "0" ] 11 then 12 # Looks like we have a messed up line, clean it up 13 VAR="`cat /var/run/dmesg.boot | grep "^md0:" | grep "ad0: " | cut -d ":" -f 3`" 8 # Create our device listing 9 ls /dev/ > /tmp/devlist 14 10 15 # Make sure this line isn't already in the file 16 cat /var/run/dmesg.boot | grep "^ad0: " >/dev/null 2>/dev/null 17 if [ "$?" != "0" ] 18 then 19 echo "ad0:${VAR}" >>/var/run/dmesg.boot 20 fi 21 fi 11 # Remove any old devlist.new file 12 rm /tmp/devlist.new >/dev/null 2>/dev/null 22 13 23 # Check for SCSI in a badly formatted /var/run/dmesg.boot file first 24 cat /var/run/dmesg.boot | grep "^md0:" | grep "da0: " >/dev/null 2>/dev/null 25 if [ "$?" = "0" ] 26 then 27 # Looks like we have a messed up line, clean it up 28 VAR="`cat /var/run/dmesg.boot | grep "^md0:" | grep "da0: " | cut -d ":" -f 3`" 29 30 # Make sure this line isn't already in the file 31 cat /var/run/dmesg.boot | grep "^da0: " >/dev/null 2>/dev/null 32 if [ "$?" != "0" ] 33 then 34 echo "da0:${VAR}" >>/var/run/dmesg.boot 35 fi 36 fi 14 # Loop through the list and add a : to the end of each dev 15 while read line 16 do 17 echo "${line}:" >> /tmp/devlist.new 18 done < /tmp/devlist 37 19 20 # Move our fixed list over to the valid list 21 mv /tmp/devlist.new /tmp/devlist 38 22 39 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` 23 # Now loop through these devices, and list the disk drives 24 for i in `egrep "^(ad|aacd|mlxd|mlyd|amrd|idad|twed|da|ar|ips|)[0-9]:" /tmp/devlist | sort | uniq` 40 25 do 41 LN="`cat /var/run/dmesg.boot | grep ^$i | grep -v "MB/s" | grep MB`" >/dev/null 42 echo ${LN} 43 fdisk /dev/${i} >/tmp/${i} 44 FOUND="1" 26 27 # Get the raw device name, no : 28 DEV="`echo ${i} | cut -d ':' -f 1`" 29 30 # Check the dmesg output for some more info about this device 31 dmesg | grep ^$DEV: | grep '<' | grep '>' >/dev/null 2>/dev/null 32 if [ "$?" = "0" ] 33 then 34 LN="`dmesg | grep ^${DEV}: | grep '<' | grep '>'`" 35 NEWLINE="`echo ${LN} | cut -d ':' -f 2`" 36 else 37 NEWLINE="<Unknown Device>" 38 fi 39 40 # Echo out the found line for PCInstall to display 41 echo "${DEV}: ${NEWLINE}" 42 43 # Get the fdisk output to be read by PCInstall next 44 fdisk /dev/${DEV} >/tmp/${DEV} 45 45 46 done 46 47 47 #If we couldn't find anything in the dmesg file, look for devices instead48 if [ "${FOUND}" = "0" ]49 then50 if [ -e "/dev/ad0" ]51 then52 echo "ad0: XXXXXXMB <Unprobed IDE Disk>"53 fdisk /dev/ad0 >/tmp/ad054 fi55 if [ -e "/dev/da0" ]56 then57 echo "ad0: XXXXXXMB <Unprobed SCSI Disk>"58 fdisk /dev/ad0 >/tmp/ad059 fi60 fi61
