#!/bin/sh
#Hank Yang @ Promise
echo "------------------------------------------------------"
echo "FastTrak series RedHat linux setup for an EXIST system"
echo "FastTrak driver configuration...."
cp modules.cgz /tmp/modules.cgz
cd /tmp
if [ ! -f modules.cgz ];then
    echo "Runtime error..setup abort!!"
    exit
fi
zcat modules.cgz | cpio -idum > /dev/null 2>&1
cd `uname -r`
pp=`uname -r | awk -F. '{print $2}'`
if [ $pp -eq 2 ] ; then
	cp ft.o /lib/modules/`uname -r`/scsi/ft.o
elif [ $pp -eq 4 ] ; then
	cp ft.o /lib/modules/`uname -r`/kernel/drivers/scsi/ft.o
	insmod scsi_mod > /dev/null 2>&1
else
	echo "Your kernel version is not support yet..."
	exit
fi
insmod ft
echo "Do you want to load FastTrak module when Linux booting everytime?"
read key
if [ $key = "Y" -o $key = "y" ] ; then
	echo "FastTrak configuration..."
	echo "" >> /etc/rc.local
	echo "#Promise FastTrak module entry" >> /etc/rc.local
	if [ $pp -eq 4 ] ; then
		echo "insmod scsi_mod" >> /etc/rc.local
	fi
	echo "insmod ft" >> /etc/rc.local
fi
rm -fr /tmp/2.* ; rm -f /tmp/modules.cgz
echo "FastTrak series driver setup successful.."
echo "                 PROMISE Technology, Inc (C)2001.11.06"
echo "------------------------------------------------------"
sync