get-scripts annotate b43-firmware @ rev 3

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