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