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

Auke Kok sofar at lunar-linux.org
Wed Feb 8 20:14:05 UTC 2006


Author: sofar
Date: 2006-02-08 20:14:02 +0000 (Wed, 08 Feb 2006)
New Revision: 18593

Modified:
   lunar-iso/trunk/lunar-install/sbin/lunar-install
Log:
* probe for new block devices after module insertion
* only probe when /proc/partitions has actually changed


Modified: lunar-iso/trunk/lunar-install/sbin/lunar-install
===================================================================
--- lunar-iso/trunk/lunar-install/sbin/lunar-install	2006-02-08 19:49:03 UTC (rev 18592)
+++ lunar-iso/trunk/lunar-install/sbin/lunar-install	2006-02-08 20:14:02 UTC (rev 18593)
@@ -138,13 +138,6 @@
 }
 
 
-input_module_parameters()
-{
-	HELP="Optionally, enter module parameters"
-	$DIALOG --nocancel --inputbox "$HELP" 0 0
-}
-
-
 load_module()
 {
   (
@@ -155,16 +148,21 @@
 	CHOICE=""
 
 	while true; do
-		MODULES=`show_modules $(pwd)`
-		CHOICE=`$DIALOG --title "$TITLE" --cancel-label "Exit" --menu "$HELP" 0 0 0 $MODULES`
+		MODULES=$(show_modules $(pwd))
+		CHOICE=$($DIALOG --title "$TITLE" --cancel-label "Exit" --menu "$HELP" 0 0 0 $MODULES)
 		if [ $? != 0 ]; then
 			return
 		fi
 		if [ -f "$CHOICE" ]; then
-			MODULE=`/bin/basename $MODULE | /bin/sed -e "s/\.o$//" -e "s/\.ko$//"`
-			PARAMETERS=`input_module_parameters` &&
-			modprobe $CHOICE $PARAMETERS
-			sleep 2
+			MODULE=$(basename $CHOICE | sed "s/\.o$//;s/\.ko$//")
+			PARAMETERS=$(inputbox "Enter module parameters (optional)") &&
+			modprobe $MODULE $PARAMETERS
+			sleep 1
+			if ! grep -qw $MODULE /proc/modules ; then
+				messagebox "The module failed to load!"
+			else
+				block_devices init
+			fi
 		elif [ -d "$CHOICE" ]; then
 			cd "$CHOICE"
 		fi
@@ -185,12 +183,17 @@
 	# superfunction to maintain, list, edit partitions and discs
 	case $1 in
 		init)
-			# remove all old disc/part devices
-			unset DEVICES
-			# fill the list with devices
-			for DEVICE in $(list_block_devices); do
-				block_devices add $DEVICE
-			done
+			# do we really need to re-do this? it's slow...
+			if [ "$(md5sum /proc/partitions)" != "$PROC_PARTITIONS_MD5" ]; then
+				# remove all old disc/part devices
+				unset DEVICES
+				# fill the list with devices
+				for DEVICE in $(list_block_devices); do
+					block_devices add $DEVICE
+				done
+				# and store the checsum for later
+				PROC_PARTITIONS_MD5="$(md5sum /proc/partitions)"
+			fi
 			;;
 		add)
 			DEVICES=( ${DEVICES[@]} $2 )
@@ -322,6 +325,7 @@
 	echo $DEVICE
 }
 
+
 menu_get_partition()
 {
 	local TITLE HELP PART



More information about the Lunar-commits mailing list