#! /bin/sh
#

. /etc/rc.status
. /etc/rc.config

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Force execution if not called by a runlevel directory.
test $link = $base && START_FOO=yes
test "$START_FOO" = yes || exit 0


# First reset status of this service
rc_reset
case "$1" in
    start)
	echo -n "Starting Internal-Modem..."

	group="uucp"
	mode="666"
	device="/dev/ttyLT0"
	olddevice="/dev/ttyS14" 

	# first unistall old installation
	#/sbin/rmmod ltmodem
 
	# now install modul
	rm -f $device
	rm -f $olddevice
	mknod $device c 62 64

	rm -f /dev/modem
	ln -s $device /dev/modem
	ln -s $device $olddevice
 	
	/sbin/insmod -f /lib/modules/2.2.16/misc/ltmodem.o

	chgrp $group $device
	chmod $mode $device

	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	echo -n "Shutting down Internal-Modem..."

	/sbin/rmmod ltmodem
 
        rm -f /dev/modem
        rm -f $device
                           

	# Remember status and be verbose
	rc_status -v
	;;
    restart)
	## If first returns OK call the second, if first or
	## second command fails, set echo return value.
	$0 stop  &&  $0 start

	# Remember status and be quiet
	rc_status
	;;
    reload)
	## Choose ONE of the following two cases:

	## First possibility: A few services accepts a signal
	## to reread the (changed) configuration.

	#echo -n "Reload service foo"
	#killproc -HUP /usr/sbin/foo
	#rc_status -v

	## Exclusive possibility: Some services must be stopped
	## and started to force a new load of the configuration.

	#$0 stop  &&  $0 start

	# Remember status and be verbose
	#rc_status -v
	;;
    status)
	echo -n "Checking for service foo: "
	## Check status with checkproc(8), if process is running
	## checkproc will return with exit status 0.

	#checkproc /usr/sbin/foo && echo OK || echo No process
	;;
    probe)
	## Optional: Probe for the necessity of a reload,
	## give out the argument which is required for a reload.

	#test /etc/foo.conf -nt /var/run/foo.pid && echo reload
	;;
    *)
	echo "Usage: $0 {start|stop|status|restart|reload[|probe]}"
	exit 1
	;;
esac
rc_exit
