Author: arekm                        Date: Wed Oct 26 19:55:58 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- rel 2; replace buggy shell code for find_modules_by_class and use lspci only.

---- Files affected:
packages/geninitrd:
   geninitrd-svn.patch (2.6 -> 2.7) , geninitrd.spec (2.188 -> 2.189) 

---- Diffs:

================================================================
Index: packages/geninitrd/geninitrd-svn.patch
diff -u packages/geninitrd/geninitrd-svn.patch:2.6 
packages/geninitrd/geninitrd-svn.patch:2.7
--- packages/geninitrd/geninitrd-svn.patch:2.6  Sat Oct 15 11:06:11 2011
+++ packages/geninitrd/geninitrd-svn.patch      Wed Oct 26 21:55:53 2011
@@ -1,232 +1,56 @@
-Index: mod-usbkbd.sh
-===================================================================
---- mod-usbkbd.sh      (wersja 0)
-+++ mod-usbkbd.sh      (wersja 12376)
-@@ -0,0 +1,45 @@
-+#!/bin/sh
-+SATA_RCSID='$Revision$ $Date$'
-+
-+# geninitrd mod: usbkbd
-+
-+# setup geninitrd module
-+# @access     public
-+setup_mod_usbkbd() {
-+}
-+
-+find_modules_usbkbd() {
-+      debug "Finding USB keyboard modules"
-+
-+      if [ "$(echo /sys/class/input/input*)" = "/sys/class/input/input*" ]; 
then
-+              return
-+      fi
-+
-+      local modules
-+
-+      for i in /sys/class/input/input*; do
-+              [ ! -f $i/device/bInterfaceClass -o ! -f 
$i/device/bInterfaceProtocol ] && continue
-+              bInterfaceClass=$(cat $i/device/bInterfaceClass)
-+              bInterfaceProtocol=$(cat $i/device/bInterfaceProtocol)
-+              if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" 
]; then
-+                      module=$(readlink $i/device/driver/module)
-+                      module=$(basename $module)
-+
-+                      if [ -n "$module" ]; then
-+                              debug "Found USB Keyboard: $(cat $i/name)"
-+                              modules="$modules $module"
-+                      fi
-+              fi
-+      done
-+
-+      if [ -n "$modules" ]; then
-+              # usb controllers
-+              for m in $(find_modules_by_class "0c03"); do
-+                      find_module $m
-+              done
-+
-+              for m in $modules; do
-+                      find_module $m
-+              done
-+      fi
-+}
-Index: geninitrd
-===================================================================
---- geninitrd  (wersja 12345)
-+++ geninitrd  (kopia robocza)
-@@ -613,7 +613,7 @@
-                       [ "$FIRMWAREDIR" != "$firmware" ] && inst_d 
/lib/firmware/$FIRMWAREDIR
-                       inst /lib/firmware/$firmware /lib/firmware/$firmware
-               else
--                      die "firmware file /lib/firmware/$firmware nor 
/lib/firmware/$kernel/$firmware found."
-+                      warn "Possible missing firmware file 
/lib/firmware/$firmware or /lib/firmware/$kernel/$firmware for module $module."
-               fi
-       done
- 
-@@ -915,7 +915,7 @@
-       warn "/proc filesystem not mounted, may cause wrong results or failure."
- fi
- 
--geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice 
suspend fbsplash condecor bootsplash uvesafb nfs sata scsi
-+geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice 
suspend fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd
- 
- while [ $# -gt 0 ]; do
-       case $1 in
-@@ -1157,6 +1157,9 @@
-       find_module "$FBMODULE"
- fi
- 
-+# autodetect USB keyboards
-+find_modules_usbkbd
-+
- # allow forcing loading SCSI and/or IDE modules
- # XXX: where ADDSCSI cames from? drop?
- if is_yes "$ADDSCSI"; then
-Index: mod-luks.sh
-===================================================================
---- mod-luks.sh        (wersja 12345)
-+++ mod-luks.sh        (kopia robocza)
-@@ -119,7 +119,7 @@
- 
-       while read dst src key opt; do
-               [ -z "$dst" -o "${dst#\#}" != "$dst" ] && continue
--              [ "$src" != "$LUKSDEV" ] && continue
-+              [ "$src" != "$LUKSDEV" ] && [ "$(readlink -f $src)" != 
"$LUKSDEV" ] && continue
- 
-               if [ -n "$key" -a "x$key" != "xnone" ]; then
-                       if test -e "$key" ; then
-@@ -155,11 +155,23 @@
-                       # cryptsetup can be called twice and in case on crypt 
on lvm only second
-                       # will succeed because there will be no src device in 
first cryptsetup call
-                       # this can be called multiple times, before lvm and 
after lvm.
--                      if [ -e "$src" ]; then
-+                      luksdev='$src'
-+                      if [ \${luksdev##/dev/disk/by-uuid/} != \${luksdev} ]; 
then
-+                              src_uuid=\${luksdev##/dev/disk/by-uuid/}
-+                              while read x y z name; do
-+                                      found_uuid=\$(cryptsetup luksUUID 
/dev/\${name} 2>/dev/null)
-+                                      if [ "\$found_uuid" = "\$src_uuid" ]; 
then
-+                                              luksdev=/dev/\$name
-+                                              break
-+                                      fi
-+                              done < /proc/partitions
-+                      fi
-+
-+                      if [ -e "\$luksdev" ]; then
-                               crypt_status=\$(cryptsetup status '$dst')
-                               if [ "\${crypt_status%%is inactive.}" != 
"\$crypt_status" ]; then
-                                       # is inactive
--                                      cryptsetup ${keyfile:+-d $keyfile} 
luksOpen '$src' '$dst' <&1
-+                                      cryptsetup ${keyfile:+-d $keyfile} 
luksOpen "\$luksdev" '$dst' <&1
-                               fi
-                       fi
- 
 Index: functions
 ===================================================================
---- functions  (wersja 12345)
+--- functions  (wersja 12390)
 +++ functions  (kopia robocza)
-@@ -166,3 +166,46 @@
-       local node="$1"
-       printf "/dev/mapper/%s" $(dm_name "$node")
- }
-+
-+# find modules by class eg
-+# find_modules_by_class 0106 - finds modules for SATA devices in the system
-+# find_modules_by_class 0c03 - finds modules for USB controllers
-+find_modules_by_class() {
-+      local req_class="$1"
-+
-+      pcimap="/lib/modules/$kernel/modules.pcimap"
-+
-+      lspci=$(find_tool /sbin/lspci)
-+      if [ ! -x "$lspci" ]; then
-+              warn "Failed to execute lspci. Is pciutils package installed?"
-+      fi
-+
-+      # no pcimap, nothing to lookup from
-+      if [ ! -f "$pcimap" ]; then
-+              return
-+      fi
-+
-+      if [ -z "$lspci" ]; then
-+              return
-+      fi
-+
-+      set -- $($lspci -n | awk -vclass=$req_class '$2 == class":" {split($3, 
p, ":"); printf("0x0000%s 0x0000%s\n", p[1], p[2])}')
-+
-+      req_class="0x${req_class}00"
-+
-+      local PCI_ANY_ID=0xffffffff pci_module vendor device subvendor 
subdevice class class_mask driver_data
-+      while read pci_module vendor device subvendor subdevice class 
class_mask driver_data; do
-+              # ignore program interface (last two digits) - we want any
-+              class_mask=$(($class_mask & 0xffffff00))
-+              # some devices (like hcd) have very specific class
-+              class=$(($class & $class_mask))
-+              [ "$(($req_class & $class_mask))" = "$class" ] || continue
-+              # match vendor
-+              [ "$1" = "$vendor" -o "$vendor" = "$PCI_ANY_ID" ] || continue
-+              # match device, allow PCI_ANY_ID
-+              [ "$2" = "$device" -o "$device" = "$PCI_ANY_ID" ] || continue
-+
-+              echo "$pci_module"
-+      done < $pcimap
-+}
-+
-Index: Makefile
-===================================================================
---- Makefile   (wersja 12345)
-+++ Makefile   (kopia robocza)
-@@ -1,6 +1,6 @@
- # when making release, make sure you do it as RELEASE document describes
- VERSION               := 12345
--MODS          := ide luks multipath dmraid lvm md blkid udev tuxonice suspend 
fbsplash condecor bootsplash uvesafb nfs sata scsi
-+MODS          := ide luks multipath dmraid lvm md blkid udev tuxonice suspend 
fbsplash condecor bootsplash uvesafb nfs sata scsi usbkbd
- FILES_MODS  := $(MODS:%=mod-%.sh)
- FILES_ADDON := extract-ikconfig
- FILES         := Makefile geninitrd.sysconfig geninitrd functions 
$(FILES_MODS) $(FILES_ADDON) geninitrd.8 geninitrd.8.xml ChangeLog
-Index: mod-sata.sh
-===================================================================
---- mod-sata.sh        (wersja 12345)
-+++ mod-sata.sh        (kopia robocza)
-@@ -6,43 +6,8 @@
- # setup geninitrd module
- # @access     public
- setup_mod_sata() {
--      lspci=$(find_tool /sbin/lspci)
--
--      pcimap="/lib/modules/$kernel/modules.pcimap"
--
--      if [ ! -x "$lspci" ]; then
--              warn "Failed to execute lspci. Is pciutils package installed?"
--      fi
- }
+@@ -189,23 +189,33 @@
+               return
+       fi
  
--# private until only mod-sata uses the function
--find_modules_by_class() {
--      local req_class=$1
--
--      # no pcimap, nothing to lookup from
--      if [ ! -f "$pcimap" ]; then
--              return
--      fi
--
--      if [ -z "$lspci" ]; then
--              return
--      fi
--
 -      set -- $($lspci -n | awk -vclass=$req_class '$2 == class":" {split($3, 
p, ":"); printf("0x0000%s 0x0000%s\n", p[1], p[2])}')
 -
--      local PCI_ANY_ID=0x0000ffff pci_module vendor device subvendor 
subdevice class class_mask driver_data
+-      req_class="0x${req_class}00"
+-
+-      local PCI_ANY_ID=0xffffffff pci_module vendor device subvendor 
subdevice class class_mask driver_data
 -      while read pci_module vendor device subvendor subdevice class 
class_mask driver_data; do
--              # match class
--              [ "$(($req_class & $class_mask))" = "$(($class))" ] || continue
+-              # ignore program interface (last two digits) - we want any
+-              class_mask=$(($class_mask & 0xffffff00))
+-              # some devices (like hcd) have very specific class
+-              class=$(($class & $class_mask))
+-              [ "$(($req_class & $class_mask))" = "$class" ] || continue
 -              # match vendor
--              [ "$1" = "$vendor" ] || continue
+-              [ "$1" = "$vendor" -o "$vendor" = "$PCI_ANY_ID" ] || continue
 -              # match device, allow PCI_ANY_ID
--              [ "$2" = "$device" -o $device = $PCI_ANY_ID ] || continue
+-              [ "$2" = "$device" -o "$device" = "$PCI_ANY_ID" ] || continue
 -
 -              echo "$pci_module"
 -      done < $pcimap
--}
--
- find_modules_sata() {
-       debug "Finding SATA modules (class=0x0106)"
++      lspci -p "$pcimap" -kvmmn | awk -vreq_class="${req_class}" '
++                                      BEGIN      { skip_modules[1]=""; 
modules[1]=""; xhci=""; ehci=""; ohci=""; uhci="" }
++                                      /^Slot:/   { found=0 }
++                                      /^Class:/  { if (req_class == $2) { 
found=1 } }
++                                      /^Driver:/ { if (found) {
++                                                              module=$2;
++                                                              if (module == 
"xhci_hcd") {
++                                                                      
xhci="xhci_hcd"
++                                                              } else if 
(module == "ehci_hcd") {
++                                                                      
ehci="ehci_hcd"
++                                                              } else if 
(module == "ohci_hcd") {
++                                                                      
ohci="ohci_hcd"
++                                                              } else if 
(module == "uhci_hcd") {
++                                                                      
uhci="uhci_hcd"
++                                                              } else if 
(!(module in skip_modules)) {
++                                                                      
modules[cnt]=module
++                                                              }
++                                                              
skip_modules[cnt]=module;
++                                                              cnt++;
++                                                 };
++                                                 found=0
++                                      }
++                                      END { 
++                                                 # xhci/ehci/ohci/uhci hack 
to preserve such order
++                                                 printf "%s %s %s %s", xhci, 
ehci, ohci, uhci;
++                                                 for (i in modules) { printf 
"%s ", modules[i]; };
++                                      }
++      '
+ }
  

================================================================
Index: packages/geninitrd/geninitrd.spec
diff -u packages/geninitrd/geninitrd.spec:2.188 
packages/geninitrd/geninitrd.spec:2.189
--- packages/geninitrd/geninitrd.spec:2.188     Fri Oct 21 22:10:26 2011
+++ packages/geninitrd/geninitrd.spec   Wed Oct 26 21:55:53 2011
@@ -8,7 +8,7 @@
 Summary(pl.UTF-8):     Narzędzie do tworzenia inicjalnego ramdysku używanego 
przy starcie systemu
 Name:          geninitrd
 Version:       12385
-Release:       1
+Release:       2
 License:       GPL
 Group:         Applications/System
 Source0:       %{name}-%{version}.tar.gz
@@ -94,7 +94,7 @@
 %patch0 -p1
 %patch1 -p1
 %endif
-#%patch2 -p0
+%patch2 -p0
 
 %build
 %{__make}
@@ -125,6 +125,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 2.189  2011/10/26 19:55:53  arekm
+- rel 2; replace buggy shell code for find_modules_by_class and use lspci only.
+
 Revision 2.188  2011/10/21 20:10:26  arekm
 Release 12385.
 
================================================================

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/geninitrd/geninitrd-svn.patch?r1=2.6&r2=2.7&f=u
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/geninitrd/geninitrd.spec?r1=2.188&r2=2.189&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to