#!/bin/sh # # $Id: rc.fritzdsl,v 1.2.2.10 2005/07/07 20:11:58 franck78 Exp $ # # Debugging. Comment it out to stop logging DEBUG="yes" msg() { if [ "z$DEBUG" != "z" ] ; then /usr/bin/logger -t red "FRITZDSL: $*" fi /bin/echo "$*" } if [ -e /var/run/need-depmod-`uname -r` ]; then echo "Update modules dependencies, may take time..." /sbin/depmod -a /bin/rm -f /var/run/need-depmod-`uname -r` fi # ID borrowed from Gentoo ebuild, # should work with 'Card DSL','Card DSL v2.0', 'Card DSL SL', 'Card DSL USB','Card DSL SL USB' # pcmcia card not compiled if ( /bin/grep "1244:2700" -q /proc/pci ); then FCDSLMODEM='sl' elif ( /bin/grep "1244:2900" -q /proc/pci ); then FCDSLMODEM='2' elif ( /bin/grep "1131:5402" -q /proc/pci ); then FCDSLMODEM='' elif ( /bin/grep "Vendor=057c ProdID=2300" -q /proc/bus/usb/devices ); then FCDSLMODEM='usb' elif ( /bin/grep "Vendor=057c ProdID=3500" -q /proc/bus/usb/devices ); then FCDSLMODEM='slusb' else FCDSLMODEM='none' fi # See how we were called. case "$1" in start) if ( /bin/grep -q "fcdsl" /proc/modules >/dev/null ); then exit 0; fi if [ "$FCDSLMODEM" = 'none' ]; then msg "No supported modem found" exit 1 fi if [ ! -f "/lib/modules/`/bin/uname -r`/misc/fcdsl$FCDSLMODEM.o.gz" ]; then msg "Driver not uploaded" exit 1 else # should use drdsl and drdsl.ini for parameters autoconfiguration or use pppsetup.cgi? /usr/sbin/capiinit -c "/etc/fcdsl/fcdsl$FCDSLMODEM.conf" start fi ;; stop) msg "stop" ;; cleanup) msg "driver cleanup" if [ "$FCDSLMODEM" = 'none' ]; then FCDSLMODEM='' fi /sbin/modprobe -r fcdslusb fcdslslusb /usr/sbin/capiinit -c "/etc/fcdsl/fcdsl$FCDSLMODEM.conf" stop if [ "$FCDSLMODEM" = 'slusb' -o "$FCDSLMODEM" = 'usb' ]; then /usr/local/bin/resetusb fi ;; *) /bin/echo "Usage: $0 {start|stop|cleanup}" exit 1 ;; esac exit 0