[PC-BSD Commits] r6027 - pcbsd/trunk/pc-sysinstall/backend-query
svn at pcbsd.org
svn at pcbsd.org
Sat Jan 23 09:09:31 PST 2010
Author: kris
Date: 2010-01-23 09:09:31 -0800 (Sat, 23 Jan 2010)
New Revision: 6027
Modified:
pcbsd/trunk/pc-sysinstall/backend-query/disk-list.sh
Log:
Switch the disk detection routine of pc-sysinstall to use sysctl kern.disks, far
more reliable
Modified: pcbsd/trunk/pc-sysinstall/backend-query/disk-list.sh
===================================================================
--- pcbsd/trunk/pc-sysinstall/backend-query/disk-list.sh 2010-01-22 00:37:48 UTC (rev 6026)
+++ pcbsd/trunk/pc-sysinstall/backend-query/disk-list.sh 2010-01-23 17:09:31 UTC (rev 6027)
@@ -1,38 +1,32 @@
#!/bin/sh
# Create our device listing
-ls /dev/ > ${TMPDIR}/devlist
+SYSDISK="`sysctl kern.disks | cut -d ':' -f 2 | sed 's/^[ \t]*//'`"
-# Remove any old devlist.new file
-rm ${TMPDIR}/devlist.new >/dev/null 2>/dev/null
-
-# Loop through the list and add a : to the end of each dev
-while read line
-do
- echo "${line}:" >> ${TMPDIR}/devlist.new
-done < ${TMPDIR}/devlist
-
-# Move our fixed list over to the valid list
-mv ${TMPDIR}/devlist.new ${TMPDIR}/devlist >/dev/null 2>/dev/null
-
# Now loop through these devices, and list the disk drives
-for i in `egrep "^(ad|ada|aacd|mlxd|mlyd|mfid|hptiop|amrd|idad|twed|da|ar|isp|ips|)[0-9]:" ${TMPDIR}/devlist | sort | uniq`
+for i in ${SYSDISK}
do
- # 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" ]
+ # Get the current device
+ DEV="${i}"
+
+ # Make sure we don't find any cd devices
+ echo "${DEV}" | grep -e "^acdi[0-9]" -e "^cd[0-9]" -e "^scd[0-9]" >/dev/null 2>/dev/null
+ if [ "$?" != "0" ]
then
- LN="`dmesg | grep ^${DEV}: | grep '<' | grep '>'`"
- NEWLINE=" <`echo ${LN} | cut -d ':' -f 2 | cut -d '<' -f 2 | cut -d '>' -f 1`>"
- else
- NEWLINE=" <Unknown Device>"
- fi
- # Echo out the found line
- echo "${DEV}:${NEWLINE}"
+ # Check the dmesg output for some more info about this device
+ dmesg | grep ^$DEV: | grep '<' | grep '>' >/dev/null 2>/dev/null
+ if [ "$?" = "0" ]
+ then
+ LN="`dmesg | grep ^${DEV}: | grep '<' | grep '>' | head -n 1`"
+ NEWLINE=" <`echo ${LN} | cut -d ':' -f 2 | cut -d '<' -f 2 | cut -d '>' -f 1`>"
+ else
+ NEWLINE=" <Unknown Device>"
+ fi
+ # Echo out the found line
+ echo "${DEV}:${NEWLINE}"
+ fi
+
done
More information about the Commits
mailing list