# This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # ndistool # ndistool/files # ndistool/files/ndistool.sh # ndistool/files/README # ndistool/pkg-descr # ndistool/Makefile # echo c - ndistool mkdir -p ndistool > /dev/null 2>&1 echo c - ndistool/files mkdir -p ndistool/files > /dev/null 2>&1 echo x - ndistool/files/ndistool.sh sed 's/^X//' >ndistool/files/ndistool.sh << 'END-of-ndistool/files/ndistool.sh' X#! /bin/sh X X# ---------------------------------------------------------------------------- X# "THE BEER-WARE LICENSE" (Revision 42) X# wrote this file. As long as you retain this notice you X# can do whatever you want with this stuff. If we meet some day, and you think X# this stuff is worth it, you can buy me a beer in return. Florent Thoumie X# ---------------------------------------------------------------------------- X# X# $FreeBSD$ X Xprefix="/usr/local" Xsharedir="${prefix}/share/ndistool" Xdistdir="${sharedir}/distfiles" X Xfetch="fetch -o" X Xif_ndis_directory="/usr/src/sys/modules/if_ndis" Xndis_directory="/usr/src/sys/modules/ndis" Xndis_card_list_url="http://people.freebsd.org/~flz/local/ndis_card_list" Xndis_card_list="${sharedir}/ndis_card_list" X Xif [ -n "${TMPDIR}" -a -d "${TMPDIR}" ]; then X tmpfile="${TMPDIR}/ndistool.XXXXXX" Xelif [ -d "/var/tmp" ]; then X tmpfile="/var/tmp/ndistool.XXXXXX" Xelif [ -d "/tmp" ]; then X tmpfile="/tmp/ndistool.XXXXXX" Xfi X Xtmpfile=$(mktemp -q ${tmpfile}) X Xuid=$(id -u) Xtest ${uid} != 0 && echo "You need to be root in order to use ndistool" && exit 1 X Xif [ ! -d ${if_ndis_directory} -o ! -d ${ndis_directory} ]; then X echo "You need ndis(4) and if_ndis(4) kernel source to use ndistool." X echo "Use your favorite tool to get it (eg. cvsup or cvs)." X exit 1 Xfi X Xdo-distclean() X{ X id="$1" X if [ ${id} = "all" ]; then X echo "Deleting all distfiles." X rm -rf ${distdir}/* X else X test ! -r ${ndis_card_list} && echo "You have no NDIS card list on your system. Use 'ndistool update'." && exit 1 X location=`grep "|${id}|" ${ndis_card_list} | cut -d\| -f3` X if [ -r ${distdir}/${location##*/} ]; then X echo "Deleting ${location##*/}." X rm -f ${distdir}/${location##*/} X else X echo "There is no ${location##*/} file in ${distdir}." X exit 1 X fi X fi X} X Xdo-fetch() X{ X id="$1" X test ! -r ${ndis_card_list} && echo "You have no NDIS card list on your system. Use 'ndistool update'." && exit 1 X location=`grep "|${id}|" ${ndis_card_list} | cut -d\| -f3` X if [ -z ${location} ]; then X echo "No such id." X exit 1 X elif [ ! -r ${distdir}/${location##*/} ]; then X mkdir ${distdir} X echo -n "Fetching ${location##*/} " X ${fetch} ${distdir}/${location##*/} ${location} >>${tmpfile} 2>&1 X if [ $? -ne 0 ]; then X echo "- failed." X echo "Fetch failed, put the file in ${distdir}." X exit 1 X else X echo "- ok." X fi X fi X md5=`grep "|${id}|" ${ndis_card_list} | cut -d\| -f4` X echo -n "Verifying checksum for ${location##*/} " X if [ `md5 -q ${distdir}/${location##*/}` != ${md5} ]; then X echo "- failed." X echo "Checksum has changed, distfile may have re-rolled." X else X echo "- ok." X fi X} X Xdo-search() X{ X pattern="$1" X test ! -r ${ndis_card_list} && echo "You have no NDIS card list on your system. Use 'ndistool update'." && exit 1 X cut -d\| -f1 -f2 ${ndis_card_list} | grep -iE "${pattern}" | awk -F\| '{ printf "%s - %s\n", $2, $1; }' X} X Xdo-update() X{ X mkdir -p ${sharedir} X # Get fresh list and put it in ${sharedir}. X echo -n "Updating NDIS card list " X ${fetch} ${sharedir}/ndis_card_list ${ndis_card_list_url} >>${tmpfile} 2>&1 X if [ $? -ne 0 ]; then X echo "- failed." X echo "Fetch failed, put the file in ${distdir}." X exit 1 X else X echo "- ok." X fi X} X Xdo-install() X{ X id="$1" X test ! -r ${ndis_card_list} && echo "You have no NDIS card list on your system. Use 'ndistool update'." && exit 1 X location=`grep "|${id}|" ${ndis_card_list} | cut -d\| -f3` X info=`grep "|${id}|" ${ndis_card_list} | cut -d\| -f5` X sys=`grep "|${id}|" ${ndis_card_list} | cut -d\| -f6` X X echo -n "Extracting ${info##*/} and ${sys##*/} from ${location##*/} into ${id} " X mkdir ${sharedir}/${id} X case ${location##*.} in X exe|zip) X unzip -qq ${distdir}/${location##*/} ${info} ${sys} -d ${sharedir}/${id}/ X ;; X rar) X unrar x ${distdir}/${location##*/} ${info} ${sys} ${sharedir}/${id}/ X ;; X tgz) X # Not sure this will happen, but who knows ? :) X tar xfz ${distdir}/${location##*/} -C ${sharedir}/${id}/ ${info} ${sys} X ;; X *) X echo "Unknown file type, please extract ${info##*/} and ${sys##*/} in ${sharedir}/${id}/" X exit 1 X ;; X esac X if [ $? -ne 0 ]; then X echo "- failed" X echo "Extraction failed, please extract ${info##*/} and ${sys##*/} in ${sharedir}/${id}/" X else X echo "- ok" X fi X X echo -n "Building ndis module " X cd ${ndis_directory}; make all >>${tmpfile} 2>&1 X if [ $? -ne 0 ]; then X echo "- failed" X else X echo "- ok" X fi X echo -n "Generating header file from ${info##*/} and ${sys##*/} " X ndiscvt -i ${sharedir}/${id}/${info} -s ${sharedir}/${id}/${sys} -o ndis_driver_data.h >>${tmpfile} 2>&1 X if [ $? -ne 0 ]; then X echo "- failed" X else X echo "- ok" X fi X echo -n "Building if_ndis module " X cd ${if_ndis_directory}; make all >>${tmpfile} 2>&1 X if [ $? -ne 0 ]; then X echo "- failed" X else X echo "- ok" X fi X} X Xdo-clean() X{ X id="$1" X if [ -z ${id} ]; then X echo "Cleaning ndis/if_ndis." X cd ${ndis_directory}; make clean >${tmpfile} 2>&1 X cd ${if_ndis_directory}; make clean >${tmpfile} 2>&1 X else X if [ -d ${sharedir}/${id} ]; then X echo "Removing ${sharedir}/${id} directory and its contents." X rm -rf ${sharedir}/${id} X else X echo "There is no ${sharedir}/${id} directory." X exit 1 X fi X fi X} X Xdo-unload() X{ X kldunload if_ndis >/dev/null 2>&1 X kldunload ndis >/dev/null 2>&1 X} X Xdo-load() X{ X do-unload X echo -n "Loading ndis module " X cd ${ndis_directory}; make load >>${tmpfile} 2>&1 X if [ $? -ne 0 ]; then X echo "- failed" X else X echo "- ok" X fi X echo -n "Loading if_ndis module " X cd ${if_ndis_directory}; make load >>${tmpfile} 2>&1 X if [ $? -ne 0 ]; then X echo "- failed" X else X echo "- ok" X fi X} X Xcmd="$1" X Xcase ${cmd} in Xdistclean) X test -z $2 && echo "usage: ndistool distclean |all" && exit 1 X do-distclean $2 X ;; Xfetch) X test -z $2 && echo "usage: ndistool fetch " && exit 1 X echo "Logfile is ${tmpfile}." X do-fetch $2 X ;; Xsearch) X test -z $2 && echo "usage: ndistool search " && exit 1 X do-search $2 X ;; Xupdate) X echo "Logfile is ${tmpfile}." X do-update X ;; Xinstall) X test -z $2 && echo "usage: ndistool install " && exit 1 X echo "Logfile is ${tmpfile}." X do-install $2 X ;; Xunload) X do-unload X ;; Xload) X do-load X ;; Xclean) X test -z $2 && echo "usage: ndistool clean " && exit 1 X do-clean $2 X ;; Xdo-the-job) X test -z $2 && echo "usage: ndistool do-the-job " && exit 1 X echo "Logfile is ${tmpfile}." X do-update X do-fetch $2 X do-clean X do-install $2 X do-load X ;; X*) X echo "usage: ndistool update" X echo " ndistool search " X echo " ndistool fetch " X echo " ndistool install " X echo " ndistool load" X echo " ndistool unload" X echo " ndistool distclean |all" X echo " ndistool do-the-job " X ;; Xesac END-of-ndistool/files/ndistool.sh echo x - ndistool/files/README sed 's/^X//' >ndistool/files/README << 'END-of-ndistool/files/README' XThis should be pretty straight-forward to use but let's write some lines about it. X XIt may seem painful to find/download yourself a driver for your wireless card, you Xmay forget what commands to type, actually I always forget these commands. X XNdistool goal is to make all of this easy. X XIt's based on a list which contains entries composed of the following fields : X X - Description, X - Identifier (see pciconf -lv output, chip part), X - Location of the driver, X - MD5 checksum, X - Location of the .inf file in the archive, X - Location of the .sys file in the archive, X XBasically, typing this (in console [1]) should be enough : X X # ndistool do-the-job 0xdeadbeef (0xdeadbeef is obtained from pciconf -lv output) X XIf this doesn't work, read the log, if 0xdeadbeef is not yet in the list, you're on Xyour own, just drop me an email with the above mentioned information when you'll Xget them, so that I add it to the list. X XDrop me an email if you notice something you think is wrong. X XI hope that'll be useful for some people. X X[1] Yes in console, if it panics in X mode you won't be able to see it. END-of-ndistool/files/README echo x - ndistool/pkg-descr sed 's/^X//' >ndistool/pkg-descr << 'END-of-ndistool/pkg-descr' XNdistool's goal is to help you to configure ndis for your wireless card. XUsually, a single command will do. X X- Florent Thoumie Xflz@FreeBSD.org END-of-ndistool/pkg-descr echo x - ndistool/Makefile sed 's/^X//' >ndistool/Makefile << 'END-of-ndistool/Makefile' X# New ports collection makefile for: ndistool X# Date created: May 11 2005 X# Whom: Florent Thoumie X# X# $FreeBSD$ X# X XPORTNAME= ndistool XPORTVERSION= 0.1 XCATEGORIES= sysutils net XMASTER_SITES= # none XDISTFILES= # none X XMAINTAINER= flz@FreeBSD.org XCOMMENT= Tool to automatically configure ndis(4) support X XNO_BUILD= yes XNO_WRKSUBDIR= yes X XPLIST_FILES= sbin/ndistool XPORTDOCS= README X Xdo-install: X ${INSTALL_SCRIPT} ${FILESDIR}/${PORTNAME}.sh ${PREFIX}/sbin/${PORTNAME} X X.if !defined(NOPORTDOCS) Xpost-install: X ${MKDIR} ${DOCSDIR} X ${INSTALL_DATA} ${FILESDIR}/${PORTDOCS} ${DOCSDIR}/ X.endif X X.include X X.if ${OSVERSION} < 500000 XIGNORE= Evil Project aka NDISulator is only for 5.x X.endif X X.include END-of-ndistool/Makefile exit