#!/bin/sh

MODULE="seaio"

DEVNAME="dio"

if [ -f "/sbin/modprobe" ]
then
	RMMOD="/sbin/modprobe"                     ## Worst case, if we ## 
elif [ -f "/sbin/insmod" ]                            ## can't find modprobe##
then                                                  ## we try rmmod ##
	RMMOD="/sbin/rmmod"
else
	echo
	echo "ALERT:"
	echo "Could not dectect modprobe or insmod"
	echo "Please edit the INSMOD variable in"
	echo "the seaio-load script"
	echo
	exit 1
fi

###############################################################################
# Make sure this is the root, or we will fail.
###############################################################################
if [ "$(id -u)" != "0" ]
then
	echo
	echo "ALERT:"
	echo "You must be root to load or unload kernel modules!"
	echo
	exit 1
fi

rm -f /dev/${DEVNAME}[0-3]

# This is the only important line.
$RMMOD -rs $MODULE


