1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#!/bin/sh
# SmartLink USB modem hotplug integration
# Eduard Bloch <blade@debian.org>, 2004
#
# If you have good ideas how to extend it to detect multiple modems,
# please tell me!
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/slmodemd
NAME=slmodemd
PIDFILE=/var/run/$NAME.usb.pid
if ! test -x $DAEMON ; then
echo "Please install sl-modem-daemon!"
fi
# You need to define options there there
test -r /etc/default/slmodemd && . /etc/default/slmodemd
# or here
test -r /etc/default/sl-modem-daemon && . /etc/default/sl-modem-daemon
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
test -r /etc/default/sl-modem-daemon && . /etc/default/sl-modem-daemon
mkdev ()
{
if test ! -e /dev/$1$2; then
mknod -m 660 /dev/$1$2 c $3 $2
chown root:dialout /dev/$1$2
fi
}
mkdev slusb 0 213
case "$ACTION" in
add)
start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --make-pidfile --background --quiet -- $OPTS /dev/slusb0 -c "$SLMODEMD_COUNTRY"
RETVAL=$?
if [ "$RETVAL" = 0 -a "$NOSYMLINK" != 1 ] ; then
echo "Creating /dev/modem symlink, pointing to: /dev/ttySL0."
ln -sf ttySL0 /dev/modem
fi
;;
remove)
start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON --quiet && rm -f $PIDFILE
# the not-so-nice termination method
if test -r $PIDFILE ; then
pid=`cat $PIDFILE`
if test "$pid" -a -e /proc/$pid ; then
kill -9 $pid && rm $PIDFILE
fi
fi
;;
esac
exit 0
|