]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/rc.d/rc.fritzdsl
git-svn-id: http://svn.ipfire.org/svn/ipfire/IPFire/source@16 ea5c0bd1-69bd-2848...
[people/teissler/ipfire-2.x.git] / src / rc.d / rc.fritzdsl
1 #!/bin/sh
2 #
3 # $Id: rc.fritzdsl,v 1.2.2.10 2005/07/07 20:11:58 franck78 Exp $
4 #
5
6 # Debugging. Comment it out to stop logging
7 DEBUG="yes"
8 msg() {
9 if [ "z$DEBUG" != "z" ] ; then
10 /usr/bin/logger -t red "FRITZDSL: $*"
11 fi
12 /bin/echo "$*"
13 }
14
15 if [ -e /var/run/need-depmod-`uname -r` ]; then
16 echo "Update modules dependencies, may take time..."
17 /sbin/depmod -a
18 /bin/rm -f /var/run/need-depmod-`uname -r`
19 fi
20
21 # ID borrowed from Gentoo ebuild,
22 # should work with 'Card DSL','Card DSL v2.0', 'Card DSL SL', 'Card DSL USB','Card DSL SL USB'
23 # pcmcia card not compiled
24 if ( /bin/grep "1244:2700" -q /proc/pci ); then
25 FCDSLMODEM='sl'
26 elif ( /bin/grep "1244:2900" -q /proc/pci ); then
27 FCDSLMODEM='2'
28 elif ( /bin/grep "1131:5402" -q /proc/pci ); then
29 FCDSLMODEM=''
30 elif ( /bin/grep "Vendor=057c ProdID=2300" -q /proc/bus/usb/devices ); then
31 FCDSLMODEM='usb'
32 elif ( /bin/grep "Vendor=057c ProdID=3500" -q /proc/bus/usb/devices ); then
33 FCDSLMODEM='slusb'
34 else
35 FCDSLMODEM='none'
36 fi
37
38 # See how we were called.
39 case "$1" in
40 start)
41 if ( /bin/grep -q "fcdsl" /proc/modules >/dev/null ); then
42 exit 0;
43 fi
44 if [ "$FCDSLMODEM" = 'none' ]; then
45 msg "No supported modem found"
46 exit 1
47 fi
48
49 if [ ! -f "/lib/modules/`/bin/uname -r`/misc/fcdsl$FCDSLMODEM.o.gz" ]; then
50 msg "Driver not uploaded"
51 exit 1
52 else
53 # should use drdsl and drdsl.ini for parameters autoconfiguration or use pppsetup.cgi?
54 /usr/sbin/capiinit -c "/etc/fcdsl/fcdsl$FCDSLMODEM.conf" start
55 fi
56 ;;
57 stop)
58 msg "stop"
59 ;;
60 cleanup)
61 msg "driver cleanup"
62 if [ "$FCDSLMODEM" = 'none' ]; then
63 FCDSLMODEM=''
64 fi
65 /sbin/modprobe -r fcdslusb fcdslslusb
66 /usr/sbin/capiinit -c "/etc/fcdsl/fcdsl$FCDSLMODEM.conf" stop
67 if [ "$FCDSLMODEM" = 'slusb' -o "$FCDSLMODEM" = 'usb' ]; then
68 /usr/local/bin/resetusb
69 fi
70 ;;
71 *)
72 /bin/echo "Usage: $0 {start|stop|cleanup}"
73 exit 1
74 ;;
75 esac
76
77 exit 0