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