# Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ S=${WORKDIR}/ndiswrapper DESCRIPTION="ndiswrapper" HOMEPAGE="http://ndiswrapper.sourceforge.net/" SRC_URI="mirror://sourceforge/ndiswrapper/ndiswrapper-0.4.tar.gz" LICENSE="" SLOT="0" KEYWORDS="~x86" IUSE="" DEPEND="sys-devel/flex" src_compile() { V=`uname -r | sed -e 's/\([^\.]*\)\.\([^\.]*\)\..*/\1\2/'` cd ${S}/driver EXT="o" if [ $V != "24" ];then mkdir ${S}/ksrc (cd ${S}/ksrc/;ln -s /lib/modules/`uname -r`/build/{.*,*} .) cat Makefile |perl -e "while() {s|(KSRC\\s*\:\=).*\$|\$1${S}/ksrc|;print}">Makefile.tmp mv Makefile.tmp Makefile export ARCH="i386" #export KSRC=${S} EXT="ko" fi make || die cd ${S}/utils make || die } src_install() { dobin ${S}/utils/loadndisdriver DIR=/lib/modules/`uname -r`/misc dodir ${DIR} cp ${S}/driver/ndiswrapper.$EXT ${D}/${DIR} dodoc ${S}/README dodoc ${S}/INSTALL dodoc ${S}/AUTHORS I=`lspci -n | grep 'Class 0280:' | awk '{print $4}'` VENDOR=`echo $I | perl -e 'while() {/^(\w*):/;print $1;}'` DEVICEID=`echo $I | perl -e 'while() {/:(\w*)$/;print $1;}'` dodir /etc/conf.d echo "SYS= #Windows SYS file" >${D}/etc/conf.d/ndiswrapper echo "INF= #Windows INF file" >>${D}/etc/conf.d/ndiswrapper echo "IFACE=wlan0" >>${D}/etc/conf.d/ndiswrapper echo "VENDERID=$VENDOR #Use lspci">> ${D}/etc/conf.d/ndiswrapper echo "DEVICEID=$DEVICEID" >>${D}/etc/conf.d/ndiswrapper dodir /etc/modules.d: echo "#!/bin/sh">${D}/etc/modules.d/ndiswrapper echo ". /etc/conf.d/ndiswrapper">>${D}/etc/modules.d/ndiswrapper echo "echo alias \$IFACE ndiswrapper">>${D}/etc/modules.d/ndiswrapper echo "echo post-install ndiswrapper loadndisdriver \$VENDERID \$DEVICEID \$SYS \$INF">>${D}/etc/modules.d/ndiswrapper chmod a+rx ${D}/etc/modules.d/ndiswrapper } pkg_postinst() { [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules einfo einfo "Get the .inf and .sys files from the windows driver and edit /etc/conf.d/ndiswrapper" einfo "and then run update-modules" einfo }