File mdc-modem.init of Package mdc-modem

#! /bin/sh
# Copyright (c) 2009 Novell, Inc.
# All rights reserved.
#
# /etc/init.d/mdc-modem
#
### BEGIN INIT INFO
# Provides:          mdc-modem
# Required-Start:    $remote_fs
# Required-Stop:     $null
# Default-Start:     3 5
# Default-Stop:
# Short-Description: load Agere soft modem modules
# Description:  This script loads the Agere soft modem modules and starts the daemon
### END INIT INFO

# Status shell functions
test -s /etc/rc.status && \
. /etc/rc.status

start_modem()
{
	agrloaded=0
	agrtrue=0
	modprobe agrdep || return
	modprobe agrmodem && agrloaded=1 
	if [ "$agrloaded" = "$agrtrue" ]
	then
		modprobe -r agrdep
		return
	else
		agrloaded=0
	fi
	modprobe agrserial && agrloaded=1
	if [ "$agrloaded" = "$agrtrue" ]
	then
		modprobe -r agrmodem
		modprobe -r agrdep
		return
	fi

  	if [ -e /dev/modem ]
  	then
      		:
  	else
  		ln -s /dev/ttyAGS3 /dev/modem
  	fi
	/sbin/startproc /usr/lib/AgereSoftModem/AgereMdmDaemon || return
}

stop_modem()
{
	modprobe -r agrserial || return
	modprobe -r agrmodem || return 
	modprobe -r agrdep || return
	/sbin/killproc /usr/lib/AgereSoftModem/AgereMdmDaemon || return
  	if [ -e /dev/modem ]
  	then
      		rm -rf /dev/modem
  	else
  		:
	fi
}

rc_reset
case "$1" in
start)
	echo -n "Starting Agere soft modem"
	start_modem
	rc_status -v
	;;
stop)
	echo -n "Shutting down Agere soft modem"
	stop_modem
	rc_status -v
	;;
reload)
	echo -n "Reloading Agere Soft modem"
	stop_modem
	start_modem
	rc_statuc -v
	;;
*)
	echo "Usage: $0 {start|stop}"
	;;
esac
rc_exit



openSUSE Build Service is sponsored by