[Lunar-commits] r17676 - lunar-iso/trunk/lunar-install/sbin

Auke Kok sofar at lunar-linux.org
Fri Dec 16 16:05:05 UTC 2005


Author: sofar
Date: 2005-12-16 16:05:01 +0000 (Fri, 16 Dec 2005)
New Revision: 17676

Modified:
   lunar-iso/trunk/lunar-install/sbin/lunar-install
Log:
Important fix: this makes the device lookup code use /proc/partitions to recognize valid block devices available in the system - and thus should also work with SATA and SCSI and other (supported) valid discs. Tested the code on several boxes to verify that it sees the proper devices.


Modified: lunar-iso/trunk/lunar-install/sbin/lunar-install
===================================================================
--- lunar-iso/trunk/lunar-install/sbin/lunar-install	2005-12-16 13:43:43 UTC (rev 17675)
+++ lunar-iso/trunk/lunar-install/sbin/lunar-install	2005-12-16 16:05:01 UTC (rev 17676)
@@ -171,17 +171,32 @@
 
 list_discs()
 {
-	local LIST LINE
-	LIST=$(ls /dev/discs)
-	for LINE in $LIST; do
-		echo "$(lsh unmap_device "/dev/discs/$LINE/disc")"
-		echo "disk"
+	local MAJOR MINOR BLOCKS NAME JUNK
+	cat /proc/partitions | tail +3 | \
+			while read MAJOR MINOR BLOCKS NAME JUNK; do
+		if [ "$MINOR" == "0" ]; then
+			echo "$(lsh unmap_device /dev/$NAME)"
+		fi
 	done
 }
 
 
-list_parts()
+list_partitions()
 {
+	local MAJOR MINOR BLOCKS NAME JUNK
+	cat /proc/partitions | tail +3 | \
+			while read MAJOR MINOR BLOCKS NAME JUNK; do
+		if [ "$MINOR" != "0" ]; then
+			echo "$(lsh unmap_device /dev/$NAME)"
+		fi
+	done
+}
+
+
+list_devices()
+{
+	# list_devices is the list of possible target devices where the
+	# system can be installed to
 	local DEVICE PTYPE FSIZE FSTYPE MNTPNT
 	for DEVICE in $SYSTEM_DEVICES ${SPECIAL_DEVICES[@]} ; do
 		if [ -e $DEVICE ]; then
@@ -221,7 +236,7 @@
 	local TITLE HELP PART
 	TITLE="Partition Selection Menu"
 	HELP="Please select a partition"
-	PART=$($DIALOG --title "$TITLE" --extra-button --extra-label "Add..." --cancel-label "Exit" --menu "$HELP" 0 0 0 `list_parts`)
+	PART=$($DIALOG --title "$TITLE" --extra-button --extra-label "Add..." --cancel-label "Exit" --menu "$HELP" 0 0 0 `list_devices`)
 	if [ $? == 3 ]; then
 		PART=$(inputbox "Enter special device node" "/dev/")
 		if [ ! -b $(readlink -f $PART) ]; then
@@ -414,7 +429,7 @@
 
 select_partition()
 {
-	SYSTEM_DEVICES=$(for DEV in $(ls -L /dev/discs/*/part*) ; do lsh unmap_device $DEV ; done)
+	SYSTEM_DEVICES=$(list_partitions)
 	while true; do
 		sleep 2
 		PART=$(get_part)



More information about the Lunar-commits mailing list