wok-current view get-wifi-firmware/stuff/get-wifi-firmware @ rev 2103
Add: wordwarvi
author | Paul Issott <paul@slitaz.org> |
---|---|
date | Wed Jan 28 20:56:55 2009 +0000 (2009-01-28) |
parents | 1f488899d7f8 |
children | dcd78f3d0238 |
line source
1 #!/bin/sh
2 # install linux-wireless, wireless_tools and b43-fwcutter if needed.
4 MODULE=$(echo $0 | sed 's/.*get-\(.*\)-firmware/\1/')
5 ROOT="$1"
6 PKG=$MODULE-firmware
7 DEPENDS=""
8 case "$MODULE" in
9 b43)
10 VERSION=4.80.53.0
11 SUBDIR="broadcom-wl-$VERSION"
12 SHORT_DESC="Broadcom $MODULE firmware."
13 WEB_SITE="http://downloads.openwrt.org/"
14 WGET_URL="${WEB_SITE}sources/$SUBDIR.tar.bz2"
15 DEPENDS="b43-fwcutter"
16 FWSET=wl_apsta.o
17 ;;
18 b43legacy)
19 VERSION=3.130.20.0
20 SHORT_DESC="Broadcom $MODULE firmware."
21 WEB_SITE="http://downloads.openwrt.org/"
22 WGET_URL="${WEB_SITE}sources/wl_apsta-$VERSION.o"
23 DEPENDS="b43-fwcutter"
24 FWSET=wl_apsta-$VERSION.o
25 ;;
26 ipw2100)
27 VERSION=1.3-6.0.1
28 SHORT_DESC="Intel PRO/Wireless 2100 firmware."
29 WEB_SITE="http://$MODULE.sourceforge.net/"
30 WGET_URL="http://dl.atrpms.net/all/$PKG-$VERSION.noarch.rpm"
31 ;;
32 ipw2200)
33 VERSION=3.0-9.0.1
34 SHORT_DESC="Intel PRO/Wireless 2200BG firmware."
35 WEB_SITE="http://$MODULE.sourceforge.net/"
36 WGET_URL="http://dl.atrpms.net/all/$PKG-$VERSION.noarch.rpm"
37 ;;
38 iwlwifi-3945)
39 VERSION=15.28.2.8
40 SHORT_DESC="Intel PRO/Wireless 3945ABG/BG firmware."
41 WEB_SITE="http://www.intellinuxwireless.org/?n=Downloads"
42 WGET_URL="http://www.intellinuxwireless.org/iwlwifi/downloads/$MODULE-ucode-$VERSION.tgz"
43 ;;
44 iwlwifi-4965)
45 VERSION=228.57.2.23
46 SHORT_DESC="Intel WiFi Link 4965AGN firmware."
47 WEB_SITE="http://www.intellinuxwireless.org/?n=Downloads"
48 WGET_URL="http://www.intellinuxwireless.org/iwlwifi/downloads/$MODULE-ucode-$VERSION.tgz"
49 ;;
50 iwlwifi-5000)
51 VERSION=5.4.A.11
52 SHORT_DESC="Intel Wireless WiFi Link 5000AGN firmware."
53 WEB_SITE="http://www.intellinuxwireless.org/?n=Downloads"
54 WGET_URL="http://www.intellinuxwireless.org/iwlwifi/downloads/$MODULE-ucode-$VERSION.tgz"
55 ;;
56 rt61)
57 VERSION=1.2
58 SHORT_DESC="RT61 Wireless Lan firmware."
59 WEB_SITE="http://www.ralinktech.com/"
60 WGET_URL="http://www.ralinktech.com.tw/data/RT61_Firmware_V$VERSION.zip"
61 ;;
62 rt73)
63 VERSION=1.0.3.6
64 SHORT_DESC="RT73(RT2571W) Wireless Lan firmware."
65 WEB_SITE="http://www.ralinktech.com/"
66 WGET_URL="http://www.ralink.com.tw/data/RT73_Linux_STA_Drv$VERSION.tar.gz"
67 ;;
68 *) echo "Unknown wifi driver. Please run one of the following commands:"
69 for i in $(cd $(dirname $0); ls get-*-firmware); do
70 [ "$i" = "get-wifi-firmware" ] && continue
71 echo " $i"
72 done
73 exit 1;;
74 esac
76 # Check if user is root to install.
77 if test $(id -u) != 0 ; then
78 echo -e "\nYou must be root to run `basename $0`."
79 echo -e "Please use 'su' and root password to become super-user.\n"
80 exit 0
81 fi
83 # Avoid reinstall
84 if [ -d $ROOT/var/lib/tazpkg/installed/$PKG ]; then
85 echo -e "\n$PKG package is already installed.\n"
86 exit 0
87 fi
89 # We need drivers, the extractor and tools.
90 for pkg in linux-wireless wireless_tools $DEPENDS
91 do
92 if [ ! -d /var/lib/tazpkg/installed/$pkg ]; then
93 tazpkg get-install $pkg
94 fi
95 done
97 # Get files
98 TMP=/tmp/$(basename $0)$$
99 mkdir $TMP
100 TOP=$PWD
101 cd $TMP
102 wget $WGET_URL
103 case "$WGET_URL" in
104 *rpm) rpm2cpio < $(basename $WGET_URL) | cpio -id;;
105 *bz2) tar xjf $(basename $WGET_URL)
106 cd $SUBDIR/kmod;;
107 *tar.gz|*tgz) tar xzf $(basename $WGET_URL);;
108 *zip) unzip $(basename $WGET_URL);;
109 *o) ;;
110 esac
112 # Create pseudo package
113 mkdir -p $PKG-$VERSION/fs/lib/firmware
114 case "$MODULE" in
115 b43*) b43-fwcutter -w "$PKG-$VERSION/fs/lib/firmware" $FWSET;;
116 ipw*) rm -f lib/firmware/*LICENSE*
117 mv lib/firmware/* $PKG-$VERSION/fs/lib/firmware;;
118 rt61) mv RT61_Firmware_V$VERSION/*.bin $PKG-$VERSION/fs/lib/firmware;;
119 rt73) mv RT73_Linux_STA_Drv$VERSION/Module/rt73.bin $PKG-$VERSION/fs/lib/firmware;;
120 iwlwifi*) mv iwlwifi*/iwlwifi*.ucode $PKG-$VERSION/fs/lib/firmware;;
121 esac
123 # Creat receipt
124 cat > $PKG-$VERSION/receipt <<EOT
125 PACKAGE="$PKG"
126 VERSION="$VERSION"
127 CATEGORY="non-free"
128 SHORT_DESC="$SHORT_DESC."
129 WEB_SITE="$WEB_SITE"
130 DEPENDS="linux-wireless wireless_tools $DEPENDS"
131 EOT
133 # Pack
134 tazpkg pack $PKG-$VERSION
136 # Install pseudo package
137 tazpkg install $PKG-$VERSION.tazpkg --root=$ROOT
139 # Clean
140 cd $TOP
141 rm -rf $TMP
143 # Check if we need wpa_supplicant
144 . $ROOT/etc/network.conf
145 if [ $WIFI_KEY_TYPE = "wpa" ] || [ $WIFI_KEY_TYPE = "WPA" ]; then
146 if [ ! -d $ROOT/var/lib/tazpkg/installed/wpa_supplicant ]; then
147 tazpkg get-install wpa_supplicant --root=$ROOT
148 fi
149 fi
151 # Configure /etc/network.conf and start connexion
152 sed -i s/'WIFI="no"'/'WIFI="yes"'/ $ROOT/etc/network.conf
154 # Load module
155 if [ -z "$ROOT" -a -n "$(modprobe -l $MODULE)" ]; then
156 echo "Loading module: $MODULE..."
157 if modprobe $MODULE ; then
158 sleep 2
159 /etc/init.d/network.sh restart
160 fi
161 fi