wok rev 1040

Add get-wifi-firmware
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 11 15:12:13 2008 +0000 (2008-07-11)
parents 0e470c71421c
children 48fcd5723861
files get-wifi-firmware/receipt get-wifi-firmware/stuff/get-wifi-firmware
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/get-wifi-firmware/receipt	Fri Jul 11 15:12:13 2008 +0000
     1.3 @@ -0,0 +1,18 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="get-wifi-firmware"
     1.7 +VERSION="1.0"
     1.8 +CATEGORY="non-free"
     1.9 +SHORT_DESC="Get misc wifi firmwares."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +WEB_SITE="See /usr/bin/$PACKAGE source"
    1.12 +
    1.13 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.14 +genpkg_rules()
    1.15 +{
    1.16 +	mkdir -p $fs/usr/bin
    1.17 +	cp stuff/$PACKAGE $fs/usr/bin
    1.18 +	for i in b43 b43legacy ipw2100 ipw2200 ; do
    1.19 +		ln -s $PACKAGE $fs/usr/bin/get-$i-firmware
    1.20 +	done
    1.21 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/get-wifi-firmware/stuff/get-wifi-firmware	Fri Jul 11 15:12:13 2008 +0000
     2.3 @@ -0,0 +1,120 @@
     2.4 +#!/bin/sh
     2.5 +# install linux-wireless, wireless_tools and b43-fwcutter if needed.
     2.6 +
     2.7 +MODULE=$(echo $0 | sed 's/.*get-\(.*\)-firmware/\1/')
     2.8 +PKG=$MODULE-firmware
     2.9 +DEPENDS=""
    2.10 +case "$MODULE" in
    2.11 +b43)
    2.12 +	VERSION=4.80.53.0
    2.13 +	SUBDIR="broadcom-wl-$VERSION"
    2.14 +	SHORT_DESC="Broadcom $MODULE firmware."
    2.15 +	WEB_SITE="http://downloads.openwrt.org/"
    2.16 +	WGET_URL="${WEB_SITE}sources/$SUBDIR.tar.bz2"
    2.17 +	DEPENDS="b43-fwcutter"
    2.18 +	FWSET=wl_apsta.o
    2.19 +	;;
    2.20 +b43legacy)
    2.21 +	VERSION=3.130.20.0
    2.22 +	SHORT_DESC="Broadcom $MODULE firmware."
    2.23 +	WEB_SITE="http://downloads.openwrt.org/"
    2.24 +	WGET_URL="${WEB_SITE}sources/wl_apsta-$VERSION.o"
    2.25 +	DEPENDS="b43-fwcutter"
    2.26 +	FWSET=wl_apsta-$VERSION.o
    2.27 +	;;
    2.28 +ipw2100)
    2.29 +	VERSION=1.3-6.0.1
    2.30 +	SHORT_DESC="Intel PRO/Wireless 2100 firmware."
    2.31 +	WEB_SITE="http://$MODULE.sourceforge.net/"
    2.32 +	WGET_URL="http://dl.atrpms.net/all/$PKG-$VERSION.noarch.rpm"
    2.33 +	;;
    2.34 +ipw2200)
    2.35 +	VERSION=3.0-9.0.1
    2.36 +	SHORT_DESC="Intel PRO/Wireless 2200BG firmware."
    2.37 +	WEB_SITE="http://$MODULE.sourceforge.net/"
    2.38 +	WGET_URL="http://dl.atrpms.net/all/$PKG-$VERSION.noarch.rpm"
    2.39 +	;;
    2.40 +*)	echo "Unknown wifi driver. Please run one of the following commands:"
    2.41 +	for i in $(cd $(dirname $0); ls get-*-firmware); do
    2.42 +		[ "$i" = "get-wifi-firmware" ] && continue
    2.43 +		echo "  $i"
    2.44 +	done
    2.45 +	exit 1;;
    2.46 +esac
    2.47 +
    2.48 +# Check if user is root to install.
    2.49 +if test $(id -u) != 0 ; then
    2.50 +        echo -e "\nYou must be root to run `basename $0`."
    2.51 +	echo -e "Please use 'su' and root password to become super-user.\n"
    2.52 +	exit 0
    2.53 +fi
    2.54 +
    2.55 +# Avoid reinstall
    2.56 +if [ -d /var/lib/tazpkg/installed/$PKG ]; then
    2.57 +	echo -e "\n$PKG package is already installed.\n"
    2.58 +	exit 0
    2.59 +fi
    2.60 +
    2.61 +# We need drivers and tools.
    2.62 +for pkg in linux-wireless wireless_tools $DEPENDS
    2.63 +do
    2.64 +        if [ ! -d /var/lib/tazpkg/installed/$pkg ]; then
    2.65 +		tazpkg get-install $pkg
    2.66 +	fi
    2.67 +done
    2.68 +
    2.69 +# Get files
    2.70 +TMP=/tmp/$(basename $0)$$
    2.71 +mkdir $TMP
    2.72 +TOP=$PWD
    2.73 +cd $TMP
    2.74 +wget $WGET_URL
    2.75 +case "$WGET_URL" in
    2.76 +*rpm)	rpm2cpio < $(basename $WGET_URL) | cpio -id;;
    2.77 +*bz2)	tar xjf $(basename $WGET_URL)
    2.78 +	cd $SUBDIR/kmod;;
    2.79 +*o)	;;
    2.80 +esac
    2.81 +	
    2.82 +# Create pseudo package
    2.83 +mkdir -p $PKG-$VERSION/fs/lib/firmware
    2.84 +case "$MODULE" in 
    2.85 +b43*)	b43-fwcutter -w "$PKG-$VERSION/fs/lib/firmware" $FWSET;;
    2.86 +ipw*)	rm -f lib/firmware/*LICENSE*
    2.87 +	mv lib/firmware/* $PKG-$VERSION/fs/lib/firmware;;
    2.88 +esac
    2.89 +
    2.90 +# Creat receipt
    2.91 +cat > $PKG-$VERSION/receipt <<EOT
    2.92 +PACKAGE="$PKG"
    2.93 +VERSION="$VERSION"
    2.94 +CATEGORY="non-free"
    2.95 +SHORT_DESC="$SHORT_DESC."
    2.96 +WEB_SITE="$WEB_SITE"
    2.97 +EOT
    2.98 +[ -n "$DEPENDS" ] echo "DEPENDS=$DEPENDS" >> $PKG-$VERSION/receipt
    2.99 +
   2.100 +# Pack
   2.101 +tazpkg pack $PKG-$VERSION
   2.102 +
   2.103 +# Install pseudo package
   2.104 +tazpkg install $PKG-$VERSION.tazpkg
   2.105 +
   2.106 +# Clean
   2.107 +cd $TOP
   2.108 +rm -rf $TMP
   2.109 +
   2.110 +# Load module
   2.111 +echo "Loading module: $MODULE..."
   2.112 +modprobe $MODULE
   2.113 +sleep 1
   2.114 +
   2.115 +# Configure /etc/network.conf and start connexion
   2.116 +sed -i s/'WIFI="no"'/'WIFI="yes"'/ /etc/network.conf
   2.117 +. /etc/network.conf
   2.118 +
   2.119 +iwconfig $WIFI_INTERFACE essid $WIFI_ESSID
   2.120 +echo "Starting udhcpc client on: $WIFI_INTERFACE... "
   2.121 +/sbin/udhcpc -b -i $WIFI_INTERFACE \
   2.122 +        -p /var/run/udhcpc.$WIFI_INTERFACE.pid
   2.123 +