#!/bin/sh
#
# ibcs         This shell script insmod's the iBCS module
#

# Source function library.
. /etc/rc.d/init.d/functions

if [ ! -f /sbin/insmod ]; then
	echo "iBCS: /sbin/insmod missing !"
	exit 0
fi

VERSION=`uname -r`

if [ ! -f /usr/lib/modules/iBCS-$VERSION ]; then
	echo "iBCS: Can not find proper version ($VERSION) !"
	exit 0
fi

# See how we were called.
case "$1" in
  start)
        # Install emulator
        echo -n "Starting iBCS emulation: "
	insmod /usr/lib/modules/iBCS-$VERSION
        echo "done"
	lsmod
        ;;
  stop)
        # Remove emulator
        echo -n "Stopping iBCS emulation: "
	rmmod iBCS-$VERSION
        echo "done"
        ;;
  *)
        echo "Usage: ibcs {start|stop}"
        exit 1
esac

exit 0
