Sophie

Sophie

distrib > Arklinux > devel > x86_64 > by-pkgid > 5b940e974faae500b8be8331a3cc5064 > files > 17

mkinitrd-5.0.17-24ark.src.rpm

--- mkinitrd-5.0.17/mkinitrd.usbroot~	2009-01-06 00:36:26.096945431 +0100
+++ mkinitrd-5.0.17/mkinitrd	2009-01-06 00:37:53.648945754 +0100
@@ -53,7 +53,7 @@ force=""
 verbose=""
 img_vers=""
 builtins=""
-modulefile=/etc/modules.conf
+modulefile=/etc/modprobe.conf
 splash=""
 rc=0
 
@@ -326,6 +326,7 @@ handlelvordev() {
     fi
 }
 
+withusb=yes
 while [ $# -gt 0 ]; do
     case $1 in
 	--fstab*)
@@ -338,7 +339,11 @@ while [ $# -gt 0 ]; do
 	    ;;
 
 	--with-usb)
-	    withusb=yes
+	    withusb=force
+	    ;;
+
+	--without-usb)
+	    withusb=""
 	    ;;
 
 	--with*)
@@ -535,25 +540,30 @@ done
 
 needusb=""
 if [ -n "$withusb" -a "x$PROBE" == "xyes" ]; then
+  if [ "$withusb" = "force" ]; then
+    needusb=1
+  else
     # If / or /boot is on a USB device include the driver. With root by
     # label we could still get some odd behaviors
     for fs in / /boot ; do
         esc=$(echo $fs | sed 's,/,\\/,g')
         dev=$(mount | awk "/ on ${esc} / { print \$1 }" | sed 's/[0-9]*$//' | cut -d/ -f3)
         if [ "$(echo $dev | cut -c1-2)" = sd ]; then
-            if [ `which kudzu 2>/dev/null` ]; then
-                host=$(kudzu --probe -b scsi |
-                gawk '/^device: '${dev}'/,/^host:/ { if (/^host/) { print $2; exit; } }')
-                if [ -d /proc/scsi/usb-storage-${host} -o -f /proc/scsi/usb-storage/${host} ]; then
-                    needusb=1
-                fi
+            # FIXME this is not perfect, if we're on a SCSI/SATA box and a
+            # USB device is connected, we get a false positive.
+            # The right thing to do(tm) is figuring out the host ID and
+            # checking for /proc/scsi/usb-storage-$hostid or
+            # /proc/scsi/usb-storage/$host
+            if [ -d /proc/scsi/usb-storage ]; then
+                needusb=1
             fi
         fi
     done
+  fi
 fi
 
 if [ -n "$needusb" -a "x$PROBE" == "xyes" ]; then
-    drivers=$(awk '/^alias[[:space:]]+usb-controller[0-9]* / { print $3}' < $modulefile)
+    drivers=$(awk '/^alias[[:space:]]+usb-controller[0-9]*[[:space:]]+/ { print $3}' < $modulefile)
     if [ -n "$drivers" ]; then
 	for driver in $drivers; do
 	    findmodule $driver
@@ -566,7 +576,7 @@ fi
 
 if [ -n "$forcescsi" -o -z "$noscsi" -a "x$PROBE" == "xyes" ]; then
     if [ ! -f $modulefile ]; then
-        modulefile=/etc/conf.modules
+        modulefile=/etc/modprobe.conf
     fi
 
     if [ -f $modulefile ]; then