compat-wireless-2010-03-10
[pandora-wifi.git] / scripts / compress_modules
1 #!/bin/bash
2 # To be used by distributions using compressed modules
3
4 COMPRESSION_FOUND="n"
5 COUNT=0;
6
7 for i in $(modprobe -l mac80211); do
8         let COUNT=$COUNT+1
9         i=${i##*/}
10         if [ "$i" = "mac80211.ko.gz" ]; then
11                 COMPRESSION_FOUND="y"
12                 continue
13         fi
14 done
15
16 if [ $COUNT -gt 2 ]; then
17         echo "More than two mac80211 modules are detected, please report this."
18         exit
19 fi
20
21 if [ $COMPRESSION_FOUND = "n" ]; then
22         exit
23 fi
24
25 DIRS="$KLIB/$KMODDIR/net/mac80211/"
26 # This handles both drivers/net/ and drivers/net/wireless/
27 DIRS="$DIRS $KLIB/$KMODDIR/net/"
28 DIRS="$DIRS $KLIB/$KMODDIR/drivers/ssb/"
29 DIRS="$DIRS $KLIB/$KMODDIR/drivers/net/usb/"
30 DIRS="$DIRS $KLIB/$KMODDIR/drivers/net/wireless/"
31 DIRS="$DIRS $KLIB/$KMODDIR/drivers/misc/eeprom/"
32
33 for i in $DIRS; do
34         if [ ! -d $i ]; then
35                 continue;
36         fi
37         for driver in $(find $i -type f -name *.ko); do
38                 gzip -9 $driver
39         done
40 done