#!/bin/sh
#
# ---- Installation-Script for DC93-MACH1 Low-Level-Driver
#
echo "installing Low-Level-Driver, Please wait..."
#
VERSION="6.1.1"
ROOT=`echo $USER`
LINUX_PATH=/usr/src/linux
LINUX_DRIVER_PATH=/usr/src/linux/drivers/scsi
ARCH="i386"
PROG_ENTRY=$0

if [ $PROG_ENTRY != "/tmp/dc_l121.sh" ]; then
	echo "must have kit in /tmp. Please copy those and unmount floppy"
	exit 1
fi
if [ $ROOT != "root" ]; then
	echo "must be root-user to install Kit"
	exit 1
fi
if [ ! -x /bin/mv ]; then
	echo "mv not installed"
	exit 1
fi
cd $LINUX_PATH
if [ $PWD != "$LINUX_PATH" ]; then
	echo "Path $LINUX_PATH does not exist"
	exit 1
fi
cd arch/$ARCH
if [ -f config.in ]; then
	echo "renaming config.in to config_in.kdw"
	mv -f config.in config_in.kdw
fi
if [ -f zImage ]; then
	echo "renaming zImage to zImage.kdw"
	mv -f zImage zImage.kdw
fi
cd $LINUX_DRIVER_PATH
if [ $PWD != "$LINUX_DRIVER_PATH" ]; then
	echo "Path $LINUX_DRIVER_PATH does not exist"
	exit 1
fi
if [ -f Makfile ]; then
	echo "renaming Makefile to Makefile.kdw"
	mv -f Makefile Makefile.kdw
fi
if [ -f hosts.c ]; then
	echo "renaming hosts.c to hosts_c.kdw"
	mv -f hosts.c hosts_c.kdw
fi
#
cd /
#
if [ ! -f /tmp/dc93kit.tgz ]; then
	echo "DC93-Kit does not exist"
	exit 1
fi
if [ ! -x /bin/tar ]; then
	echo "tar is not installed"
	exit 1
fi
echo "installing the Kit-Files to Target for Driver-Version $VERSION"
/bin/tar xvzf /tmp/dc93kit.tgz
sync
echo "please insert new empty floppy in drive A"
sleep 10
cd $LINUX_PATH
mv drivers/scsi/dc93.o drivers/scsi/dc93_o.tmp
echo "sitting on $PWD, now doing make clean, make config, make dep, make zdisk"
make clean
sync
mv drivers/scsi/dc93_o.tmp drivers/scsi/dc93.o
make config
sync
make dep
sync
make zdisk
sync
rdev -R /dev/fd0 1
echo "doing reboot, please standby and leave Diskette in Drive"
cd /
sync
reboot

