wok-next view get-wifi-firmware/stuff/get-wifi-firmware @ rev 1935
get-wifi-firmware: add rt61 support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Dec 26 18:08:09 2008 +0000 (2008-12-26) |
parents | 840b64d8f454 |
children | 1f488899d7f8 |
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 rt61)
39 VERSION=1.2
40 SHORT_DESC="RT61 Wireless Lan firmware."
41 WEB_SITE="http://www.ralinktech.com/"
42 WGET_URL="http://www.ralinktech.com.tw/data/RT61_Firmware_V$VERSION.zip"
43 ;;
44 rt73)
45 VERSION=1.0.3.6
46 SHORT_DESC="RT73(RT2571W) Wireless Lan firmware."
47 WEB_SITE="http://www.ralinktech.com/"
48 WGET_URL="http://www.ralink.com.tw/data/RT73_Linux_STA_Drv$VERSION.tar.gz"
49 ;;
50 *) echo "Unknown wifi driver. Please run one of the following commands:"
51 for i in $(cd $(dirname $0); ls get-*-firmware); do
52 [ "$i" = "get-wifi-firmware" ] && continue
53 echo " $i"
54 done
55 exit 1;;
56 esac
58 # Check if user is root to install.
59 if test $(id -u) != 0 ; then
60 echo -e "\nYou must be root to run `basename $0`."
61 echo -e "Please use 'su' and root password to become super-user.\n"
62 exit 0
63 fi
65 # Avoid reinstall
66 if [ -d $ROOT/var/lib/tazpkg/installed/$PKG ]; then
67 echo -e "\n$PKG package is already installed.\n"
68 exit 0
69 fi
71 # We need drivers, the extractor and tools.
72 for pkg in linux-wireless wireless_tools $DEPENDS
73 do
74 if [ ! -d /var/lib/tazpkg/installed/$pkg ]; then
75 tazpkg get-install $pkg
76 fi
77 done
79 # Get files
80 TMP=/tmp/$(basename $0)$$
81 mkdir $TMP
82 TOP=$PWD
83 cd $TMP
84 wget $WGET_URL
85 case "$WGET_URL" in
86 *rpm) rpm2cpio < $(basename $WGET_URL) | cpio -id;;
87 *bz2) tar xjf $(basename $WGET_URL)
88 cd $SUBDIR/kmod;;
89 *tar.gz) tar xzf $(basename $WGET_URL);;
90 *zip) unzip $(basename $WGET_URL);;
91 *o) ;;
92 esac
94 # Create pseudo package
95 mkdir -p $PKG-$VERSION/fs/lib/firmware
96 case "$MODULE" in
97 b43*) b43-fwcutter -w "$PKG-$VERSION/fs/lib/firmware" $FWSET;;
98 ipw*) rm -f lib/firmware/*LICENSE*
99 mv lib/firmware/* $PKG-$VERSION/fs/lib/firmware;;
100 rt61) mv RT61_Firmware_V$VERSION/$PKG-$VERSION/fs/lib/firmware;;
101 rt73) mv RT73_Linux_STA_Drv$VERSION/Module/rt73.bin $PKG-$VERSION/fs/lib/firmware;;
102 esac
104 # Creat receipt
105 cat > $PKG-$VERSION/receipt <<EOT
106 PACKAGE="$PKG"
107 VERSION="$VERSION"
108 CATEGORY="non-free"
109 SHORT_DESC="$SHORT_DESC."
110 WEB_SITE="$WEB_SITE"
111 DEPENDS="linux-wireless wireless_tools $DEPENDS"
112 EOT
114 # Pack
115 tazpkg pack $PKG-$VERSION
117 # Install pseudo package
118 tazpkg install $PKG-$VERSION.tazpkg --root=$ROOT
120 # Clean
121 cd $TOP
122 rm -rf $TMP
124 # Check if we need wpa_supplicant
125 . $ROOT/etc/network.conf
126 if [ $WIFI_KEY_TYPE = "wpa" ] || [ $WIFI_KEY_TYPE = "WPA" ]; then
127 if [ ! -d $ROOT/var/lib/tazpkg/installed/wpa_supplicant ]; then
128 tazpkg get-install wpa_supplicant --root=$ROOT
129 fi
130 fi
132 # Configure /etc/network.conf and start connexion
133 sed -i s/'WIFI="no"'/'WIFI="yes"'/ $ROOT/etc/network.conf
135 # Load module
136 if [ -z "$ROOT" ]; then
137 echo "Loading module: $MODULE..."
138 if modprobe $MODULE ; then
139 sleep 2
140 /etc/init.d/network.sh restart
141 fi
142 fi