
#!/bin/bash

# moduleInstall - 10/24/2000 release - (C) 1997-2000 Cyclades Corporation
# This script attempt to install the cyclades driver without kernel
# compilation.
# Distribution permitted under the terms of the GNU "copyleft".

EXEC_DIR='pwd'

echo "---------------------------------------------------------------------"
echo "Cyclades Linux Driver - Module Instalation"
echo "Copyright (C) Cyclades Corporation, 1997-2001"
echo "---------------------------------------------------------------------"
echo
echo "The cyclades driver can run as a loadable module or can run inside the" 
echo "kernel without performance differences. This process can install the "
echo "cyclades driver as a module in a compiled kernel, you just need of the"
echo "source tree of this kernel under /usr/src/linux."
echo "Otherwise the installation have to be done mannually (look up README "
echo "for details)."
echo
echo "1 - Install cyclades driver as a loadable module"
echo "2 - Let me do it by myself"
echo

while true
do
	echo -e "Please choose one (1 or 2) => \c"
	read OPTION

	case $OPTION in

		1)
			break;
			;;
		2)
			exit 
			;;
		*)
			;;
	esac
done	

echo
echo "Checking the kernel......."

if [ -f /usr/src/linux/include/linux/modversions.h ]; then
	echo "OK"
else
	echo "Sorry, It seems this kernel wasn't compiled yet. I can't"
	echo "find /usr/src/linux/include/linux/modversions.h. The module"
	echo "instalation can't continue."
	exit
fi

echo "Instaling cyclades module into kernel $RELEASE"
echo

cd ./module
cp -pf /usr/src/linux/drivers/char/cyclades.c .
make

mkdir -p /lib/modules/$RELEASE/kernel/drivers/char/
cp cyclades.o /lib/modules/$RELEASE/kernel/drivers/char/

cd /usr/src/linux
if [ -r System.map ]; then /sbin/depmod -ae -F System.map  $RELEASE; fi

exit 
