#!/bin/sh
#
### BEGIN INIT INFO
# Provides: aksparlnx
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Description:  Aladdin HASP/Hardlock parallel port driver
### END INIT INFO
# $Id: aksparlnx.suse,v 1.2 2002/11/13 13:45:59 chris Exp $

. /etc/rc.status
#. /etc/rc.config
. /opt/aksparlnx/etc/kversion
. /opt/aksparlnx/etc/major

## 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_AKSPARLNX=yes
#test "$START_AKSPARLNX" = yes || exit 0
#
# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status

# First reset status of this service
rc_reset
case "$1" in
    start)
	echo -n "Loading Aladdin HASP/Hardlock driver"

	# load module
	modprobe parport_pc
	insmod $USEFORCE /opt/aksparlnx/drv/$KVERSION/aksparlnx.o major=$MAJOR

	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	echo -n "Unloading Aladdin HASP/Hardlock driver"
	rmmod aksparlnx
	# Remember status and be verbose
	rc_status -v
	;;
    restart)
	$0 stop  &&  $0 start

	# Remember status and be quiet
	rc_status
	;;
    reload)

	$0 stop  &&  $0 start

	# Remember status and be verbose
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|restart|reload}"
	exit 1
	;;
esac
rc_exit
