# Multiports/PCI 
# Installation Scripts 2001. 8.
# SystemBase Co., Ltd.

CLS=`clear` > /dev/null 2>&1

####### begin 

./Remove

echo $CLS
echo -e "====================================================="
echo -e "  Multiports/PCI Device Driver ver 1.0  Installation    "
echo -e "                                                     "
echo -e "  (c) SystemBase Co., Ltd. (02) 583-9748             "
echo -e "====================================================="

if uname -r | grep 2.2.[0-9][^0-9] > /dev/null
then
cp 2.2.x.low driver.s
fi

if uname -r | grep 2.2.1[0-4] > /dev/null
then
cp 2.2.x.low driver.s
fi

if uname -r | grep 2.2.1[5-9] > /dev/null
then
cp 2.2.x.high driver.s
fi

if uname -r | grep 2.2.20 > /dev/null
then
cp 2.2.x.high driver.s
fi

if uname -r | grep 2.4.[0-2] > /dev/null
then
cp 2.4.x.low driver.s
fi

VER=$(uname -r)
echo "1,30s/xxxxx/$VER/g" > TMP
echo "." >> TMP
echo "w" >> TMP
echo "q" >> TMP
if cp driver.s driver.org
then
	echo xxxx > /dev/null
else
	echo -e "sorry...Not supported at this version..."
	echo -e "this driver cover from Ver 2.2.0 to Ver 2.4.2 now"
	echo -e "please contact us for more information"
	exit 1 
fi
ed driver.s < TMP > /dev/null 2>&1
rm -f TMP

make driver.o > /dev/null 2>&1
make multiport.o > /dev/null 2>&1

rm -f driver.o
rm -f driver.s
mv driver.org driver.s


sleep 1
echo $CLS

/sbin/insmod multiport.o

gcc -o bdcfg bdcfg.s 2>&1

./bdcfg > /dev/null 2>&1

rm -f bdcfg

cp /etc/inittab /etc/inittab.00
grep -v 'ttyMP' < /etc/inittab.00 > /etc/inittab 
rm -f /etc/inittab.00
ed /etc/inittab < Node > /dev/null 2>&1
rm -f Node

CURR_PATH="/sbin/insmod `pwd`/multiport.o"
echo "$" > APL
echo "a">> APL
echo $CURR_PATH >> APL
echo "." >> APL
echo "w" >> APL
echo "q" >> APL
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.org
grep -v '$CURR_PATH' < /etc/rc.d/rc.local.org > /etc/rc.d/rc.local
rm -f /etc/rc.d/rc.local.org
ed /etc/rc.d/rc.local < APL > /dev/null 2>&1
rm -f APL
#Install end
