wok-stable view get-wifi-firmware/stuff/get-wifi-firmware @ rev 2532

nss_ldap: fix post_install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Mar 19 07:37:46 2009 +0000 (2009-03-19)
parents e2b01c6b7e75
children 32959e7975fc
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.150.10.5
11 SUBDIR="broadcom-wl-$VERSION"
12 SHORT_DESC="Broadcom $MODULE firmware."
13 WEB_SITE="http://www.linuxwireless.org/en/users/Drivers/b43"
14 WGET_URL="http://mirror2.openwrt.org/sources/$SUBDIR.tar.bz2"
15 DEPENDS="b43-fwcutter"
16 FWSET=wl_apsta_mimo.o
17 ;;
18 b43legacy)
19 VERSION=3.130.20.0
20 SHORT_DESC="Broadcom $MODULE firmware (BCM4306 rev2 or 802.11b chips)."
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|rt61pci)
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|rt73usb)
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 zd1211|zd1211rw)
69 VERSION=2.16.0.0-0.1
70 SHORT_DESC="zd1211/zd1211rw Wireless Lan firmware."
71 WEB_SITE="http://packages.debian.org/etch/zd1211-firmware"
72 WGET_URL="http://mirrors.kernel.org/debian/pool/non-free/z/zd1211-firmware/zd1211-firmware_${VERSION}_all.deb"
73 ;;
74 rt2860)
75 VERSION=11
76 SHORT_DESC="RT2860 Wireless Lan firmware."
77 WEB_SITE="http://www.ralinktech.com/"
78 WGET_URL="http://www.ralink.com.tw/data/RT2860_Firmware_V$VERSION.zip"
79 ;;
80 *) echo "Unknown wifi driver. Please run one of the following commands:"
81 for i in $(cd $(dirname $0); ls get-*-firmware); do
82 [ -L $i ] || continue
83 [ "$(readlink $i)" = "get-wifi-firmware" ] || continue
84 echo " $i"
85 done
86 exit 1;;
87 esac
89 # Check if user is root to install.
90 if test $(id -u) != 0 ; then
91 echo -e "\nYou must be root to run `basename $0`."
92 echo -e "Please use 'su' and root password to become super-user.\n"
93 exit 0
94 fi
96 # Avoid reinstall
97 if [ -d $ROOT/var/lib/tazpkg/installed/$PKG ]; then
98 echo -e "\n$PKG package is already installed.\n"
99 exit 0
100 fi
102 # We need drivers, the extractor and tools.
103 for pkg in linux-wireless wireless_tools $DEPENDS
104 do
105 if [ ! -d /var/lib/tazpkg/installed/$pkg ]; then
106 tazpkg get-install $pkg
107 fi
108 done
110 # Get files
111 TMP=/tmp/$(basename $0)$$
112 mkdir $TMP
113 TOP=$PWD
114 cd $TMP
115 wget $WGET_URL
116 case "$WGET_URL" in
117 *rpm) rpm2cpio < $(basename $WGET_URL) | cpio -id;;
118 *deb) dpkg-deb -x $(basename $WGET_URL) . ;;
119 *bz2) tar xjf $(basename $WGET_URL)
120 cd $SUBDIR/driver;;
121 *tar.gz|*tgz) tar xzf $(basename $WGET_URL);;
122 *zip) unzip $(basename $WGET_URL);;
123 *o) ;;
124 esac
126 # Create pseudo package
127 mkdir -p $PKG-$VERSION/fs/lib/firmware
128 case "$MODULE" in
129 b43*) b43-fwcutter -w "$PKG-$VERSION/fs/lib/firmware" $FWSET;;
130 ipw*) rm -f lib/firmware/*LICENSE*
131 mv lib/firmware/* $PKG-$VERSION/fs/lib/firmware;;
132 rt61|rt61pci|rt2860)
133 mv RT*_Firmware_V$VERSION/*.bin $PKG-$VERSION/fs/lib/firmware;;
134 rt73|rt73usb)
135 mv RT73_Linux_STA_Drv$VERSION/Module/rt73.bin $PKG-$VERSION/fs/lib/firmware;;
136 iwlwifi*) mv iwlwifi*/iwlwifi*.ucode $PKG-$VERSION/fs/lib/firmware;;
137 zd1211|zd1211rw)
138 mv lib/firmware/zd1211 $PKG-$VERSION/fs/lib/firmware
139 for i in $(cd usr/lib/hotplug/firmware; ls); do
140 target=$(readlink usr/lib/hotplug/firmware/$i)
141 ln -s $(basename $target) $PKG-$VERSION/fs/lib/firmware/zd1211/$i
142 done;;
143 esac
145 # Creat receipt
146 cat > $PKG-$VERSION/receipt <<EOT
147 PACKAGE="$PKG"
148 VERSION="$VERSION"
149 CATEGORY="non-free"
150 SHORT_DESC="$SHORT_DESC."
151 WEB_SITE="$WEB_SITE"
152 DEPENDS="linux-wireless wireless_tools $DEPENDS"
153 EOT
155 # Pack
156 tazpkg pack $PKG-$VERSION
158 # Install pseudo package
159 tazpkg install $PKG-$VERSION.tazpkg --root=$ROOT
161 # Clean
162 cd $TOP
163 rm -rf $TMP
165 # Check if we need wpa_supplicant
166 . $ROOT/etc/network.conf
167 if [ $WIFI_KEY_TYPE = "wpa" ] || [ $WIFI_KEY_TYPE = "WPA" ]; then
168 if [ ! -d $ROOT/var/lib/tazpkg/installed/wpa_supplicant ]; then
169 tazpkg get-install wpa_supplicant --root=$ROOT
170 fi
171 fi
173 # Configure /etc/network.conf and start connexion
174 sed -i s/'WIFI="no"'/'WIFI="yes"'/ $ROOT/etc/network.conf
176 # Load module
177 if [ -z "$ROOT" -a -n "$(modprobe -l $MODULE)" ]; then
178 echo "Loading module: $MODULE..."
179 if modprobe $MODULE ; then
180 sleep 2
181 /etc/init.d/network.sh restart
182 fi
183 fi