wok-current rev 3446
Add: get-softmodem-driver - get drivers for integrated modems (hsfmodem only at this time)
author | Dominique Corbex <domcox@users.sourceforge.net> |
---|---|
date | Sun Jun 14 23:53:53 2009 +0200 (2009-06-14) |
parents | d80bbe920b1e |
children | ef3739944bb7 |
files | get-softmodem-driver/receipt get-softmodem-driver/stuff/get-softmodem-driver |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/get-softmodem-driver/receipt Sun Jun 14 23:53:53 2009 +0200 1.3 @@ -0,0 +1,19 @@ 1.4 +# SliTaz package receipt. 1.5 + 1.6 +PACKAGE="get-softmodem-driver" 1.7 +VERSION="0.1" 1.8 +CATEGORY="non-free" 1.9 +SHORT_DESC="Get misc softmodem drivers." 1.10 +MAINTAINER="domcox@slitaz.org" 1.11 +DEPENDS="cpio linux-source slitaz-toolchain" 1.12 +WEB_SITE="http://hg.slitaz.org/wok/file/$PACKAGE/stuff/$PACKAGE" 1.13 + 1.14 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.15 +genpkg_rules() 1.16 +{ 1.17 + mkdir -p $fs/usr/bin 1.18 + cp stuff/$PACKAGE $fs/usr/bin 1.19 + for i in hsfmodem; do 1.20 + ln -s $PACKAGE $fs/usr/bin/get-$i-driver 1.21 + done 1.22 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/get-softmodem-driver/stuff/get-softmodem-driver Sun Jun 14 23:53:53 2009 +0200 2.3 @@ -0,0 +1,141 @@ 2.4 +#!/bin/sh 2.5 +# install softmodems drivers if needed. 2.6 + 2.7 +MODULE=$(echo $0 | sed 's/.*get-\(.*\)-driver/\1/') 2.8 +ROOT="$1" 2.9 +DEPENDS="" 2.10 + 2.11 +case "$MODULE" in 2.12 +hsfmodem) 2.13 + VERSION="7.80.02.03full" 2.14 + TARBALL="$MODULE-$VERSION.tar.gz" 2.15 + SHORT_DESC="Modem driver for Conexant HSF chipsets" 2.16 + WEB_SITE="http://www.linuxant.com/drivers" 2.17 + WGET_URL="http://www.linuxant.com/drivers/hsf/full/archive/$MODULE-$VERSION/$TARBALL" 2.18 + DEPENDS="linux-source module-init-tools" 2.19 + ;; 2.20 +*) echo "Unknown modem driver. Please run one of the following commands:" 2.21 + for i in $(cd $(dirname $0); ls get-*-driver); do 2.22 + [ -L $i ] || continue 2.23 + [ "$(readlink $i)" = "get-modem-driver" ] || continue 2.24 + echo " $i" 2.25 + done 2.26 + exit 1;; 2.27 +esac 2.28 + 2.29 +# Check if user is root to install. 2.30 +if test $(id -u) != 0 ; then 2.31 + echo -e "\nYou must be root to run `basename $0`." 2.32 + echo -e "Please use 'su' and root password to become super-user.\n" 2.33 + exit 0 2.34 +fi 2.35 + 2.36 +# Avoid reinstall 2.37 +if [ -d $ROOT/var/lib/tazpkg/installed/$MODULE ]; then 2.38 + echo -e "\n$MODULE-$VERSION package is already installed.\n" 2.39 + exit 0 2.40 +fi 2.41 + 2.42 +# Check linux-source 2.43 +cp /proc/config.gz . && gunzip config.gz 2.44 +DIFF=$(diff /usr/src/linux/.config config | awk 'BEGIN{i=0}/^[-+]/{ i++} END{print i}') 2.45 +rm -f config config.gz 2.46 +if [ $DIFF -gt 2 ]; then 2.47 + echo "Warning: Linux source .config and currently installed .config don't match." 2.48 + echo "Please rebuild and install kernel with the proper .config file." 2.49 + sleep 3 2.50 +fi 2.51 + 2.52 + 2.53 +# Get files 2.54 +cd /usr/src 2.55 +echo "Checking for source tarball... " 2.56 +if [ ! -f "$TARBALL" ]; then 2.57 + wget $WGET_URL 2.58 + # Exit if download failed to avoid errors. 2.59 + if [ ! -f "$TARBALL" ]; then 2.60 + echo -e "\nDownload failed, exiting. Please check WGET_URL variable.\n" 2.61 + exit 1 2.62 + fi 2.63 +fi 2.64 + 2.65 +case "$WGET_URL" in 2.66 +*rpm) rpm2cpio < $(basename $WGET_URL) | cpio -id;; 2.67 +*deb) dpkg-deb -x $(basename $WGET_URL) . ;; 2.68 +*bz2) tar xjf $(basename $WGET_URL) ;; 2.69 +*tar.gz|*tgz) tar xzf $(basename $WGET_URL) ;; 2.70 +*zip) unzip $(basename $WGET_URL);; 2.71 +*o) ;; 2.72 +esac 2.73 + 2.74 +# Set dirs 2.75 +src=/usr/src/$MODULE-$VERSION 2.76 +_pkg=$src/_pkg 2.77 +taz=/tmp/sm$RANDOM$RANDOM$RANDOM.$$ 2.78 +fs=$taz/$MODULE-$VERSION/fs 2.79 +mkdir -p $fs 2.80 + 2.81 +# Create pseudo package 2.82 +case "$MODULE" in 2.83 +hsfmodem) 2.84 + # Rules to configure and make the package. 2.85 + cd $src 2.86 + # set DESTDIR 2.87 + sed -i 's/ROOT=.*/ROOT=$(DESTDIR)/' config.mak 2.88 + # Make Makefile busybox compliant 2.89 + sed -i 's/chmod --reference=\$</chmod 755/' config.mak 2.90 + sed -i 's/uname -i/uname -m/' makefile # 7.80 2.91 + sed -i 's/uname --machine/uname -m/' modules/Makefile 2.92 + sed -i 's/uname --hardware-platform/uname -p/g' modules/Makefile 2.93 + # Make utilities busybox compliant 2.94 + sed -i 's/cmp --silent/cmp -s/g' scripts/cnxtconfig.in 2.95 + sed -i 's/ls --ignore=flush_nvm ${procdrvdir}/ls ${procdrvdir} | grep -v flush_nvm/' scripts/cnxtconfig.in 2.96 + sed -i 's/cat -v/cat/g' scripts/cnxtconfig.in 2.97 + sed -i 's/a-z /a-z/g' scripts/cnxtconfig.in 2.98 + sed -i 's/A-Z_/A-Z/g' scripts/cnxtconfig.in 2.99 + # Remove link to /dev/modem 2.100 + sed -i 's/rm -f \/dev\/modem.*/echo/g' scripts/cnxtconfig.in 2.101 + sed -i 's/alias \/dev\/modem \/dev\/ttyS@CNXTSERDEV@/alias \/dev\/modem none/' scripts/cnxtconfig.in 2.102 + sed -i 's/mv \/dev\/modem.*/echo/' scripts/cnxtconfig.in 2.103 + sed -i 's/ln -sf \/dev\/ttyS.*/echo/' scripts/cnxtconfig.in 2.104 + # Set SliTaz as dist name 2.105 + sed -i 's/OSDISTNAME=unknown/OSDISTNAME=SliTaz/' scripts/cnxtconfig.in 2.106 + sed -i 's/OSDISTIDNT=unknown/OSDISTIDNT=slitaz/' scripts/cnxtconfig.in 2.107 + sed -i 's/OSDISTVERS=unknown/OSDISTVERS=\$(cat \/etc\/slitaz-release)/' scripts/cnxtconfig.in 2.108 + # Build 2.109 + make DESTDIR=$_pkg install 2.110 + cd $_pkg/usr/lib/hsfmodem/modules 2.111 + make 2.112 + 2.113 + # Rules to gen a SliTaz package suitable for Tazpkg. 2.114 + mkdir -p $fs/usr 2.115 + cp -a $_pkg/usr/sbin $fs/usr 2.116 + MODS_DIR=$fs/lib/modules/`uname -r`/extra 2.117 + mkdir -p $MODS_DIR 2.118 + cp -a $_pkg/usr/lib/hsfmodem/modules/*.ko $MODS_DIR 2.119 + ;; 2.120 +esac 2.121 + 2.122 + 2.123 +# Create receipt 2.124 +cd $taz 2.125 +cat > $MODULE-$VERSION/receipt <<EOT 2.126 +PACKAGE="$MODULE" 2.127 +VERSION="$VERSION" 2.128 +CATEGORY="non-free" 2.129 +SHORT_DESC="$SHORT_DESC." 2.130 +WEB_SITE="$WEB_SITE" 2.131 +DEPENDS="$DEPENDS" 2.132 +EOT 2.133 + 2.134 +# Pack 2.135 +# tazpkg pack $MODULE-$VERSION-$VERSION 2.136 +tazpkg pack $MODULE-$VERSION 2.137 + 2.138 +# Install pseudo package 2.139 +tazpkg install $MODULE-$VERSION.tazpkg --root=$ROOT 2.140 + 2.141 +# Clean 2.142 +rm -rf $taz 2.143 +cd $src 2.144 +make clean