home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 May / pcp151c.iso / misc / src / install / pci-probing / pcidevinfomerge < prev    next >
Encoding:
Text File  |  1998-01-06  |  1.0 KB  |  57 lines

  1. #!/bin/bash
  2. #
  3. # given linux/drivers/pci/pci.c from a 2.x kernel, strips out the 
  4. # struct containing PCI vendor and device ids
  5. #
  6. #
  7. # uses exclude.lst good-video.lst, good-eth.lst and good-scsi.lst
  8. #
  9.  
  10. #
  11. # expects a list of entries to ignore in file specified as $1
  12. #
  13. #if [ ! -e "$1" ]; then
  14. #    echo "Must specify file containing exclusion list as arg 1"
  15. #    exit 1
  16. #fi
  17.  
  18. #
  19. # old list of acceptable entries is $2
  20. #
  21. #if [ ! -e "$2" ]; then
  22. #    echo "Must specify file containing old good entries as arg 2"
  23. #    exit 1
  24. #fi
  25.  
  26. #
  27. # store list in a temporary file
  28. #
  29. tmpfile=/tmp/pcilist$$
  30. trap 'rm -f $tmpfile; exit' INT TERM
  31.  
  32. awk '
  33.  
  34. BEGIN { foundit = 0 }
  35.  
  36. # now read in lines till we hit the last line
  37. {
  38. if (foundit && $0 ~ /\;/) exit
  39.  
  40. if (foundit) print $0
  41.  
  42. if ($0 ~ /struct pci_dev_info dev_info/) foundit = 1
  43. }
  44.  
  45. END { }
  46.  
  47. ' > $tmpfile
  48.  
  49. #
  50. # tmpfile now holds the new 'all.lst'. Merge with the existing good and exclude
  51. # lists
  52. #
  53. cat exclude.lst good-scsi.lst good-video.lst good-eth.lst $tmpfile | sort -bdf +1 | sed "s/,$//" | uniq --unique
  54.  
  55. #rm -f $tmpfile
  56. exit
  57.