wok-4.x rev 12310

get-wifi-firmware: remove hard coded versions
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Jul 11 11:20:57 2012 +0200 (2012-07-11)
parents 04656cd66c4a
children 2f85faa0e9ba
files get-wifi-firmware/stuff/get-wifi-firmware
line diff
     1.1 --- a/get-wifi-firmware/stuff/get-wifi-firmware	Wed Jul 11 11:12:14 2012 +0200
     1.2 +++ b/get-wifi-firmware/stuff/get-wifi-firmware	Wed Jul 11 11:20:57 2012 +0200
     1.3 @@ -5,97 +5,112 @@
     1.4  ROOT="$2"
     1.5  PKG=$MODULE-firmware
     1.6  DEPENDS=""
     1.7 +
     1.8 +MODULE_LIST=""
     1.9 +while read module desc ; do
    1.10 +	[ "$MODULE" == "$module" ] && desc="$SHORT_DESC"
    1.11 +	MODULE_LIST="$MODULE_LIST $module"
    1.12 +done <<EOT
    1.13 +b43		Broadcom $MODULE firmware.
    1.14 +b43legacy	Broadcom $MODULE firmware (BCM4306 rev2 or 802.11b chips).
    1.15 +ipw2100		Intel PRO/Wireless 2100 firmware.
    1.16 +ipw2200		Intel PRO/Wireless 2200BG firmware.
    1.17 +iwlwifi-3945	Intel PRO/Wireless 3945ABG/BG firmware.
    1.18 +iwlwifi-4965	Intel WiFi Link 4965AGN firmware.
    1.19 +iwlwifi-5000	Intel Wireless WiFi Link 5000AGN firmware.
    1.20 +iwlwifi-5150	Intel Wireless WiFi Link 5150AGN firmware.
    1.21 +iwlwifi-1000	Intel Wireless WiFi Link 1000BGN firmware.
    1.22 +iwlwifi-6000	Intel Wireless WiFi Link 6000 Series Wi-fi Adapters.
    1.23 +rt61		new RT2x00 RT61 Wireless Lan firmware.
    1.24 +rt61pci		new RT2x00 RT61 Wireless Lan firmware.
    1.25 +rt73		new RT2x00 RT73(RT2571W) Wireless Lan firmware.
    1.26 +rt73usb		new RT2x00 RT73(RT2571W) Wireless Lan firmware.
    1.27 +rt2870usb	RaLink RT2870USB (RT2870/RT2770) WiFi adapter.
    1.28 +zd1211		zd1211/zd1211rw Wireless Lan firmware.
    1.29 +zd1211rw	zd1211/zd1211rw Wireless Lan firmware.
    1.30 +EOT
    1.31 +
    1.32  case "$MODULE" in
    1.33  b43)
    1.34 -	VERSION=4.150.10.5
    1.35 +	WEB_SITE="http://www.linuxwireless.org/en/users/Drivers/b43"
    1.36 +	WGET_URL="http://mirror2.openwrt.org/sources"
    1.37 +	VERSION=$(wget -O - $WGET_URL | sed \
    1.38 +	  '/broadcom-wl-[0-9\.]*.tar/!d;s/.*com-wl-\([0-9\.]*\).tar.*/\1/' | \
    1.39 +	  tail -n 1)
    1.40  	SUBDIR="broadcom-wl-$VERSION"
    1.41 -	SHORT_DESC="Broadcom $MODULE firmware."
    1.42 -	WEB_SITE="http://www.linuxwireless.org/en/users/Drivers/b43"
    1.43 -	WGET_URL="http://mirror2.openwrt.org/sources/$SUBDIR.tar.bz2"
    1.44 +	WGET_URL="$WGET_URL/$SUBDIR.tar.bz2"
    1.45  	DEPENDS="b43-fwcutter"
    1.46  	FWSET=wl_apsta_mimo.o
    1.47  	;;
    1.48  b43legacy)
    1.49 -	VERSION=3.130.20.0
    1.50 -	SHORT_DESC="Broadcom $MODULE firmware (BCM4306 rev2 or 802.11b chips)."
    1.51  	WEB_SITE="http://downloads.openwrt.org/"
    1.52 +	VERSION=$(wget -O - ${WEB_SITE}sources | sed \
    1.53 +	  '/wl_apsta/!d;s/.*>wl_apsta-\(.*\).o.*/\1/')
    1.54  	WGET_URL="${WEB_SITE}sources/wl_apsta-$VERSION.o"
    1.55  	DEPENDS="b43-fwcutter"
    1.56  	FWSET=wl_apsta-$VERSION.o
    1.57  	;;
    1.58  ipw2100)
    1.59 -	VERSION=1.3
    1.60 -	SHORT_DESC="Intel PRO/Wireless 2100 firmware."
    1.61 +	VERSION=$(wget -O - http://$MODULE.sourceforge.net/firmware.php?fid=2 |\
    1.62 +		sed '/$MODULE-fw/!d;s/.*fw-\(.*\).tgz.*/\1/')
    1.63  	WEB_SITE="http://$MODULE.sourceforge.net/"
    1.64  	WGET_URL="http://bughost.org/firmware/${MODULE}-fw-${VERSION}.tgz"
    1.65  	;;
    1.66  ipw2200)
    1.67 -	VERSION=3.1
    1.68 -	SHORT_DESC="Intel PRO/Wireless 2200BG firmware."
    1.69 +	VERSION=$(wget -O - http://$MODULE.sourceforge.net/firmware.php?fid=8 |\
    1.70 +		sed '/$MODULE-fw/!d;s/.*fw-\(.*\).tgz.*/\1/')
    1.71  	WEB_SITE="http://$MODULE.sourceforge.net/"
    1.72  	WGET_URL="http://bughost.org/firmware/${MODULE}-fw-${VERSION}.tgz"
    1.73  	;;
    1.74 -iwlwifi-3945)
    1.75 -	VERSION=15.32.2.9
    1.76 -	SHORT_DESC="Intel PRO/Wireless 3945ABG/BG firmware."
    1.77 +iwlwifi-*)
    1.78  	WEB_SITE="http://www.intellinuxwireless.org/?n=Downloads"
    1.79 +	VERSION=$(wget -O - $WEB_SITE | sed -e "/$MODULE-/!d" -e \
    1.80 +		's/.*-ucode-\([0-9\.-]*\).t.*/\1/;q')
    1.81  	WGET_URL="http://www.intellinuxwireless.org/iwlwifi/downloads/$MODULE-ucode-$VERSION.tgz"
    1.82  	;;
    1.83 -iwlwifi-4965)
    1.84 -	VERSION=228.61.2.24
    1.85 -	SHORT_DESC="Intel WiFi Link 4965AGN firmware."
    1.86 -	WEB_SITE="http://www.intellinuxwireless.org/?n=Downloads"
    1.87 -	WGET_URL="http://www.intellinuxwireless.org/iwlwifi/downloads/$MODULE-ucode-$VERSION.tgz"
    1.88 +rt61*)
    1.89 +	WGET_URL="http://archlinux.c3sl.ufpr.br/other/rt2x00-rt61-fw"
    1.90 +	VERSION=$(wget -O - $WGET_URL | sed '/Firmware/!d;s/.*_V\(.*\).zip.*/\1/')
    1.91 +	WEB_SITE="http://www.ralinktech.com/"
    1.92 +	WGET_URL="$WGET_URL/RT61_Firmware_V${VERSION}.zip"
    1.93  	;;
    1.94 -iwlwifi-5000)
    1.95 -	VERSION=8.24.2.12
    1.96 -	SHORT_DESC="Intel Wireless WiFi Link 5000AGN firmware."
    1.97 -	WEB_SITE="http://www.intellinuxwireless.org/?n=Downloads"
    1.98 -	WGET_URL="http://www.intellinuxwireless.org/iwlwifi/downloads/$MODULE-ucode-$VERSION.tgz"
    1.99 -	;;
   1.100 -iwlwifi-5150)
   1.101 -	VERSION=8.24.2.2
   1.102 -	SHORT_DESC="Intel Wireless WiFi Link 5150AGN firmware."
   1.103 -	WEB_SITE="http://www.intellinuxwireless.org/?n=Downloads"
   1.104 -	WGET_URL="http://www.intellinuxwireless.org/iwlwifi/downloads/$MODULE-ucode-$VERSION.tgz"
   1.105 -	;;
   1.106 -iwlwifi-1000)
   1.107 -	VERSION=128.50.3.1
   1.108 -	SHORT_DESC="Intel Wireless WiFi Link 1000BGN firmware."
   1.109 -	WEB_SITE="http://www.intellinuxwireless.org/?n=Downloads"
   1.110 -	WGET_URL="http://www.intellinuxwireless.org/iwlwifi/downloads/$MODULE-ucode-$VERSION.tgz"
   1.111 -	;;
   1.112 -iwlwifi-6000)
   1.113 -	VERSION=9.176.4.1
   1.114 -	SHORT_DESC="Intel Wireless WiFi Link 6000 Series Wi-fi Adapters"
   1.115 -	WEB_SITE="http://www.intellinuxwireless.org/?n=Downloads"
   1.116 -	WGET_URL="http://www.intellinuxwireless.org/iwlwifi/downloads/$MODULE-ucode-$VERSION.tgz"
   1.117 -	;;
   1.118 -rt61|rt61pci)
   1.119 -	VERSION=1.2
   1.120 -	SHORT_DESC="new RT2x00 RT61 Wireless Lan firmware."
   1.121 +rt73*)
   1.122 +	WGET_URL="http://archlinux.c3sl.ufpr.br/other/rt2x00-rt71w-fw"
   1.123 +	VERSION=$(wget -O - $WGET_URL | sed '/Firmware/!d;s/.*_V\(.*\).zip.*/\1/')
   1.124  	WEB_SITE="http://www.ralinktech.com/"
   1.125 -	WGET_URL="ftp://ftp.archlinux.org/other/rt2x00-rt61-fw/RT61_Firmware_V${VERSION}.zip"
   1.126 -	;;
   1.127 -rt73|rt73usb)
   1.128 -	VERSION=1.8
   1.129 -	SHORT_DESC="new RT2x00 RT73(RT2571W) Wireless Lan firmware."
   1.130 -	WEB_SITE="http://www.ralinktech.com/"
   1.131 -	WGET_URL="ftp://ftp.archlinux.org/other/rt2x00-rt71w-fw/RT71W_Firmware_V${VERSION}.zip"
   1.132 +	WGET_URL="$WGET_URL/RT71W_Firmware_V${VERSION}.zip"
   1.133  	;;
   1.134  rt2870usb)
   1.135 -	VERSION=8
   1.136 -	SHORT_DESC="RaLink RT2870USB (RT2870/RT2770) WiFi adapter."
   1.137 +	WGET_URL="http://archlinux.c3sl.ufpr.br/other/${MODULE}-fw"
   1.138 +	VERSION=$(wget -O - $WGET_URL | sed '/Firmware/!d;s/.*_V\(.*\).zip.*/\1/')
   1.139  	WEB_SITE="http://www.ralinktech.com/"
   1.140 -	WGET_URL="ftp://ftp.archlinux.org/other/${MODULE}-fw/RT2870_Firmware_V${VERSION}.zip"
   1.141 +	WGET_URL="$WGET_URL/RT2870_Firmware_V${VERSION}.zip"
   1.142  	;;
   1.143 -zd1211|zd1211rw)
   1.144 -	VERSION=2.21.0.0-1
   1.145 +zd1211*)
   1.146 +	WGET_URL="http://mirrors.kernel.org/debian/pool/non-free/z/zd1211-firmware"
   1.147 +	VERSION=$(wget -O - $WGET_URL | sed -e '/zd1211-firmware/!d' \
   1.148 +	  -e '/all.deb/!d' -e 's/.*>zd1211-firmware_\(.*\)_all.deb.*/\1/')
   1.149  	SHORT_DESC="zd1211/zd1211rw Wireless Lan firmware."
   1.150  	WEB_SITE="http://packages.debian.org/etch/zd1211-firmware"
   1.151 -	WGET_URL="http://mirrors.kernel.org/debian/pool/non-free/z/zd1211-firmware/zd1211-firmware_${VERSION}_all.deb"
   1.152 +	WGET_URL="$WGET_URL/zd1211-firmware_${VERSION}_all.deb"
   1.153  	;;
   1.154 -*)	echo "Unknown wifi driver. Please run one of the following commands:"
   1.155 +*)
   1.156 +	case "$1" in
   1.157 +	--install)
   1.158 +		cd $(dirname $0)
   1.159 +		for i in $MODULE_LIST ; do
   1.160 +			ln -s get-wifi-firmware get-$i-firmware
   1.161 +		done
   1.162 +		exit 0 ;;
   1.163 +	--get-free-firmware)
   1.164 +		for i in $MODULE_LIST ; do
   1.165 +			case "$i" in
   1.166 +			iwlwifi*|rt*) get-$i-firmware
   1.167 +			esac
   1.168 +		done
   1.169 +		exit 0 ;;
   1.170 +	esac
   1.171 +	echo "Unknown wifi driver. Please run one of the following commands:"
   1.172  	for i in $(cd $(dirname $0); ls get-*-firmware); do
   1.173  		[ -L $i ] || continue
   1.174  		[ "$(readlink $i)" = "get-wifi-firmware" ] || continue
   1.175 @@ -132,7 +147,7 @@
   1.176  cd $TMP
   1.177  wget $WGET_URL
   1.178  TARBALL="$(basename $WGET_URL)"
   1.179 -if [ ! -f $TARBALL ]; then
   1.180 +if [ ! -s $TARBALL ]; then
   1.181  	cd $TOP
   1.182  	rm -rf $DIR
   1.183  	echo "Could not download $TARBALL. Exiting."
   1.184 @@ -162,7 +177,7 @@
   1.185  	mv RT*_Firmware_V$VERSION/*LICENSE* $PKG-$VERSION/fs/usr/share/licenses/ralink-rt61-LICENSE.txt;;
   1.186  iwlwifi*) mv iwlwifi*/iwlwifi*.ucode $PKG-$VERSION/fs/lib/firmware
   1.187  		  mv iwlwifi*/*LICENSE* $PKG-$VERSION/fs/usr/share/licenses/intel-iwlwifi-LICENSE.txt	;;
   1.188 -zd1211|zd1211rw)
   1.189 +zd1211*)
   1.190  	mv lib/firmware/zd1211 $PKG-$VERSION/fs/lib/firmware 
   1.191  	for i in $(cd usr/lib/hotplug/firmware; ls); do
   1.192  		target=$(readlink usr/lib/hotplug/firmware/$i)