get-scripts view b43-firmware @ rev 31

javajre: tiny fix
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jan 26 10:44:20 2015 +0100 (2015-01-26)
parents 5aedb6b0e87c
children 6ca05e6839e1
line source
1 # install linux-wireless, wireless_tools and b43-fwcutter if needed.
3 MODULE=${PACKAGE%-firmware}
4 CATEGORY="non-free"
5 DEPENDS=""
7 MODULE_LIST=""
8 while read module desc ; do
9 [ "$MODULE" == "$module" ] && desc="$SHORT_DESC"
10 MODULE_LIST="$MODULE_LIST $module"
11 done <<EOT
12 b43 Broadcom $MODULE firmware.
13 b43legacy Broadcom $MODULE firmware (BCM4306 rev2 or 802.11b chips).
14 ipw2100 Intel PRO/Wireless 2100 firmware.
15 ipw2200 Intel PRO/Wireless 2200BG firmware.
16 iwlwifi-5000 Intel Wireless WiFi Link 5000AGN, 5300AGN and 5350AGN firmware.
17 iwlwifi-5150 Intel Wireless WiFi Link 5150AGN firmware.
18 iwlwifi-100 Intel Wireless WiFi Link 100N firmware.
19 iwlwifi-105 Intel Wireless WiFi Link 105N firmware.
20 iwlwifi-135 Intel Wireless WiFi Link 135N firmware.
21 iwlwifi-1000 Intel Wireless WiFi Link 1000N firmware.
22 iwlwifi-2000 Intel Wireless WiFi Link 2200 Series Wi-fi Adapters.
23 iwlwifi-2030 Intel Wireless WiFi Link 2230 Series Wi-fi Adapters.
24 iwlwifi-6000gda Intel Wireless WiFi Link 6000 Series Wi-fi Adapters.
25 iwlwifi-6000gdb Intel Wireless WiFi Link 6000 Series Wi-fi Adapters.
26 iwlwifi-6000 Intel Wireless WiFi Link 6000 Series Wi-fi Adapters.
27 iwlwifi-6050 Intel Wireless WiFi Link 6050 Series Wi-fi Adapters.
28 rt61 new RT2x00 RT61 Wireless Lan firmware.
29 rt61pci new RT2x00 RT61 Wireless Lan firmware.
30 rt73 new RT2x00 RT73(RT2571W) Wireless Lan firmware.
31 rt73usb new RT2x00 RT73(RT2571W) Wireless Lan firmware.
32 rt2870usb RaLink RT2870USB (RT2870/RT2770) WiFi adapter.
33 zd1211 zd1211/zd1211rw Wireless Lan firmware.
34 zd1211rw zd1211/zd1211rw Wireless Lan firmware.
35 EOT
37 case "$MODULE" in
38 b43)
39 WEB_SITE="http://www.linuxwireless.org/en/users/Drivers/b43"
40 WGET_URL="http://mirror2.openwrt.org/sources"
41 VERSION=$(wget -O - $WGET_URL | sed \
42 '/broadcom-wl-[0-9\.]*.tar/!d;s/.*com-wl-\([0-9\.]*\).tar.*/\1/' | \
43 tail -n 1)
44 SUBDIR="broadcom-wl-$VERSION"
45 WGET_URL="$WGET_URL/$SUBDIR.tar.bz2"
46 DEPENDS="b43-fwcutter"
47 FWSET=wl_apsta.o
48 ;;
49 b43legacy)
50 WEB_SITE="http://downloads.openwrt.org/"
51 VERSION=$(wget -O - ${WEB_SITE}sources | sed \
52 '/wl_apsta/!d;s/.*>wl_apsta-\(.*\).o.*/\1/')
53 WGET_URL="${WEB_SITE}sources/wl_apsta-$VERSION.o"
54 DEPENDS="b43-fwcutter"
55 FWSET=wl_apsta-$VERSION.o
56 ;;
57 ipw2*)
58 WEB_SITE="http://wireless.kernel.org/en/users/Drivers/$MODULE"
59 VERSION=$(wget -O - $WEB_SITE | sed '/-fw/!d;s/.*-fw-\([^t]*\).t.*/\1/')
60 WGET_URL="$(wget -O - $WEB_SITE | sed '/-fw/!d;s/.*href="\([^"]*\).*/\1/')$MODULE-fw-$VERSION.tgz"
61 ;;
62 iwlwifi-*)
63 WEB_SITE="http://wireless.kernel.org/en/users/Drivers/iwlwifi/"
64 WGET_URL="$(wget -O - $WEB_SITE | sed '/-ucode-/!d;s/.*href="\([^"]*\).*/\1/;/'${MODULE%firmware}'/!d' | sed '$!d')"
65 VERSION="$(echo "$WGET_URL" | sed 's/.*-ucode-\(.*\).t.*/\1/')"
66 CATEGORY="base-system"
67 ;;
68 rt61*)
69 WGET_URL="http://archlinux.c3sl.ufpr.br/other/rt2x00-rt61-fw"
70 VERSION=$(wget -O - $WGET_URL | sed '/Firmware/!d;s/.*_V\(.*\).zip.*/\1/')
71 WEB_SITE="http://www.ralinktech.com/"
72 WGET_URL="$WGET_URL/RT61_Firmware_V${VERSION}.zip"
73 CATEGORY="base-system"
74 ;;
75 rt73*)
76 WGET_URL="http://archlinux.c3sl.ufpr.br/other/rt2x00-rt71w-fw"
77 VERSION=$(wget -O - $WGET_URL | sed '/Firmware/!d;s/.*_V\(.*\).zip.*/\1/')
78 WEB_SITE="http://www.ralinktech.com/"
79 WGET_URL="$WGET_URL/RT71W_Firmware_V${VERSION}.zip"
80 CATEGORY="base-system"
81 ;;
82 rt2870usb)
83 WGET_URL="http://archlinux.c3sl.ufpr.br/other/${MODULE}-fw"
84 VERSION=$(wget -O - $WGET_URL | sed '/Firmware/!d;s/.*_V\(.*\).zip.*/\1/')
85 WEB_SITE="http://www.ralinktech.com/"
86 WGET_URL="$WGET_URL/RT2870_Firmware_V${VERSION}.zip"
87 CATEGORY="base-system"
88 ;;
89 zd1211*)
90 WGET_URL="http://mirrors.kernel.org/debian/pool/non-free/z/zd1211-firmware"
91 VERSION=$(wget -O - $WGET_URL | sed -e '/zd1211-firmware/!d' \
92 -e '/all.deb/!d' -e 's/.*>zd1211-firmware_\(.*\)_all.deb.*/\1/')
93 SHORT_DESC="zd1211/zd1211rw Wireless Lan firmware."
94 WEB_SITE="http://packages.debian.org/etch/zd1211-firmware"
95 WGET_URL="$WGET_URL/zd1211-firmware_${VERSION}_all.deb"
96 ;;
97 esac
99 case "$WGET_URL" in
100 ftp*|http*) ;;
101 *) WGET_URL="${WEB_SITE%/}/$WGET_URL"
102 esac
104 # We need drivers, the extractor and tools.
105 for pkg in linux-wireless wireless_tools $DEPENDS
106 do
107 if [ ! -d $ROOT/var/lib/tazpkg/installed/$pkg ]; then
108 tazpkg get-install $pkg --root=$ROOT
109 fi
110 done
112 # Get files
113 wget $WGET_URL
114 TARBALL="$(basename $WGET_URL)"
115 [ -s $TARBALL ] || abort_package "Could not download $TARBALL. Exiting."
117 case "$WGET_URL" in
118 *rpm) rpm2cpio < $TARBALL | cpio -id;;
119 *deb) dpkg-deb -x $TARBALL . ;;
120 *bz2) tar xjf $TARBALL
121 cd $SUBDIR/linux;;
122 *tar.gz|*tgz) tar xzf $TARBALL;;
123 *zip) unzip $TARBALL;;
124 *o) ;;
125 esac
127 # Create pseudo package
128 mkdir -p $PACKAGE-$VERSION/fs/lib/firmware $PACKAGE-$VERSION/fs/usr/share/licenses
129 case "$MODULE" in
130 b43*) b43-fwcutter -w "$PACKAGE-$VERSION/fs/lib/firmware" $FWSET;;
131 ipw2200) cp ${MODULE}-fw-$VERSION/*LICENSE* $PACKAGE-$VERSION/fs/usr/share/licenses/intel-$MODULE-LICENSE.txt
132 mv ${MODULE}-fw-$VERSION/* $PACKAGE-$VERSION/fs/lib/firmware;;
133 ipw2100) cp *LICENSE* $PACKAGE-$VERSION/fs/usr/share/licenses/intel-$MODULE-LICENSE.txt
134 mv *.fw* *LICENSE* $PACKAGE-$VERSION/fs/lib/firmware;;
135 rt*)
136 mv RT*_Firmware_V$VERSION/*.bin $PACKAGE-$VERSION/fs/lib/firmware
137 mv RT*_Firmware_V$VERSION/*LICENSE* $PACKAGE-$VERSION/fs/usr/share/licenses/ralink-rt61-LICENSE.txt;;
138 iwlwifi*) mv iwlwifi*/iwlwifi*.ucode $PACKAGE-$VERSION/fs/lib/firmware
139 mv iwlwifi*/*LICENSE* $PACKAGE-$VERSION/fs/usr/share/licenses/intel-iwlwifi-LICENSE.txt ;;
140 zd1211*)
141 mv lib/firmware/zd1211 $PACKAGE-$VERSION/fs/lib/firmware ;;
142 esac
144 # Creat receipt
145 cat > $PACKAGE-$VERSION/receipt <<EOT
146 PACKAGE="$PACKAGE"
147 VERSION="$VERSION"
148 CATEGORY="$CATEGORY"
149 SHORT_DESC="$SHORT_DESC."
150 WEB_SITE="$WEB_SITE"
151 DEPENDS="linux-wireless wireless_tools $DEPENDS"
153 # Pre and post install commands for Tazpkg.
154 post_install()
155 {
156 echo -n "Configure wifi ? "
157 read -t 30 answer
158 case "\$answer" in
159 n*|N*) return
160 esac
162 echo "configuring and loading module ..."
163 # Check if we need wpa_supplicant
164 . \$1/etc/network.conf
165 if [ \$WIFI_KEY_TYPE = "wpa" ] || [ \$WIFI_KEY_TYPE = "WPA" ]; then
166 if [ ! -d \$1/var/lib/tazpkg/installed/wpa_supplicant ]; then
167 tazpkg get-install wpa_supplicant --root=\$1
168 fi
169 fi
171 # Configure /etc/network.conf and start connexion
172 sed -i s/'WIFI="no"'/'WIFI="yes"'/ \$1/etc/network.conf
174 # Load module
175 if [ -z "\$1" -a -n "\$(modprobe -l $MODULE)" ]; then
176 echo "Loading module: $MODULE..."
177 if modprobe $MODULE ; then
178 sleep 2
179 /etc/init.d/network.sh restart
180 fi
181 fi
182 }
183 EOT
185 set +e