home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / pmi / blacklist-modules.sh next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2006-03-20  |  598 b   |  26 lines

  1. #!/bin/bash
  2.  
  3. # Walk a directory, assembling a list of modules that need to be blacklisted
  4. # Then check which modules are loaded, and return those as a string
  5.  
  6. . /etc/defaults/pmi
  7.  
  8. if [ ! -d $BLACKLISTDIR ]; then
  9.         echo "No such directory $BLACKLISTDIR, exiting" >&2
  10.         exit 1
  11. fi
  12.  
  13. for file in $(find $BLACKLISTDIR -type f -print "%p "); do
  14.         MODSLIST="$MODSLIST "$(<$file);
  15. done
  16.  
  17. MODSLOADED=$(lsmod|awk '!/Module/ {print $1}')
  18.  
  19. for mod in $MODSLIST; do
  20.         if echo $MODSLOADED|grep -q -w "$mod"; then
  21.                 BLACKLIST="$BLACKLIST $mod"
  22.         fi
  23. done
  24.  
  25. echo $BLACKLIST
  26.