]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
switch to parsing in shell instead of awk
authorElan Ruusamäe <glen@pld-linux.org>
Fri, 11 Feb 2011 08:19:31 +0000 (08:19 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Fri, 11 Feb 2011 08:19:31 +0000 (08:19 +0000)
svn-id: @12139

mod-sata.sh

index ea2df44f9667cea8fc67dcf1af2e891fba1e2bae..59f46f3eb5bfa2c19c29b1c6cb5db9224335f066 100644 (file)
@@ -28,7 +28,16 @@ find_modules_by_class() {
        fi
 
        set -- $($lspci -n | awk -vclass=$class '$2 == class":" {split($3, p, ":"); printf("0x0000%s 0x0000%s\n", p[1], p[2])}')
-       awk -vvendor=$1 -vdevice=$2 '$2 == vendor && $3 == device {print $1}' $pcimap
+
+       local 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
+               # vendor match is exact
+               [ "$1" = "$vendor" ] || continue
+               # device match is exact
+               [ "$2" = $device ] || continue
+
+               echo "$pci_module"
+       done < $pcimap
 }
 
 find_modules_sata() {
This page took 0.033692 seconds and 4 git commands to generate.