#! /bin/sh
#
# This script loads and unloads the realtime kernel module
# Configuration can be put into /etc/default/realtime
#
# Author:	Guenter Geiger <geiger@debian.org>
#
#
# Version:	0.1
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=realtime
DESC="Realtime Module"

# Gracefully exit if the package has been removed.
test "`modprobe -l $NAME`" != "" || exit 0

# Read config file if it is present.
[ -r /etc/default/$NAME.conf ] && . /etc/default/$NAME.conf

# The module has to be enabled 
test "$ENABLE" = "yes" || exit 0

set -e

case "$1" in
  start)
	echo -n "Loading $DESC: $NAME"
	modprobe $NAME $PARAMETERS
	echo "."
	;;
  stop)
	echo -n "Unloading $DESC: $NAME "
	modprobe -r $NAME
	echo "."
	;;
  restart|force-reload)
	echo -n "Restarting $DESC: $NAME"
	modprobe -r $NAME
	sleep 1
	modprobe $NAME $PARAMETERS
	echo "."
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
