diff options
Diffstat (limited to 'net-dialup/speedtouch/files/speedtouch.initd')
-rw-r--r-- | net-dialup/speedtouch/files/speedtouch.initd | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/net-dialup/speedtouch/files/speedtouch.initd b/net-dialup/speedtouch/files/speedtouch.initd new file mode 100644 index 000000000000..1894378f8d63 --- /dev/null +++ b/net-dialup/speedtouch/files/speedtouch.initd @@ -0,0 +1,70 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-dialup/speedtouch/files/speedtouch.initd,v 1.1 2005/11/01 04:59:52 mrness Exp $ + +depend() { + need localmount modules +} + +start() { + ebegin "Starting Speedtouch ADSL Modem..." + + ps -e | grep -q modem_run + if [ $? -eq 0 ]; then + einfo "Firmware already loaded, skipping load" + else + + einfo "Loading firmware..." + + if [ -z "${MICROCODE}" ]; then + eend 1 "Please define \$MICROCODE in /etc/conf.d/speedtouch" + return 1 + fi + if [ ! -f ${MICROCODE} ]; then + eend 1 "Failed to find the microcode." + return 1 + fi + # usbdevfs is up ? + if [ ! -f /proc/bus/usb/devices ]; then + eend 1 "usbdevfs not mounted" + return 1 + fi + + # Remove unreleased semaphore - previous instance of modem_run left it (bug #109595) + (ipcs -s | grep ^0xdeadbeef &>/dev/null) && ipcrm -S 0xdeadbeef + + modem_run -v $VERBOSE $MODEM_RUN_EXTRAOPTS -f $MICROCODE + if [ $? -ne 0 ]; then # modem_run CAN'T run + eerror "Can't load the microcode !!" + eerror "Please detach and attach again your modem to the USB port to unload the microcode." + eerror "Then run '/etc/init.d/speedtouch start'" + eend 1 "Speedtouch firmware load failed" + return 1 + fi + + + einfo "Speedtouch firmware loaded" + eend 0 + fi + + if [ ! -f "/etc/ppp/peers/$PEER" ]; then + eend 1 "Failed to find peer configuration" + return 1 + fi + + einfo "Launching the PPP daemon..." + rm -f /var/run/pppoa*.pid + start-stop-daemon --start \ + --exec /usr/sbin/pppd call $PEER &>/dev/null + + eend $? "Failed to start the PPP daemon" +} + +stop() { + ebegin "Shutting down the SpeedTouch ADSL Modem..." + + start-stop-daemon --stop --pidfile /var/run/ppp0.pid pppd + + eend $? "Failed to stop 'pppd'." +} |