#!/bin/sh
# Copyright (c) 1995  En Garde Systems. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, for NON COMMERCIAL USE are permitted provided that:
# (1) source code distributions retain the above copyright notice and this
# paragraph in its entirety, and (2) distributions including binary code
# include the above copyright notice and this paragraph in its entirety in
# the documentation or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# For commercial use or modification of this program, contact:
# En Garde Systems
# 525 Clara Avenue, Suite 202
# St. Louis, MO  63112
#

if (id | grep root) >/dev/null
then
	:
else
	echo This script must be run as root.
	exit 1
fi

if [ ! -f ./twtchc ]
then
	echo This script must be run in the directory containing \"twtchc\".
	exit 1
fi

echo Seting up device driver for this system... To do this, we MUST move
echo the \"twtchc\" driver into \"/usr/kernel/drv\". 
echo "Procede with this copy? (y/N): \\c" 
read x
if [ $x != 'y' ]
then
	echo "Installation aborted..."
	exit 1
fi
echo Installing...\\c
cp ./twtchc* /usr/kernel/drv
if [ -d /usr/kernel/drv/sparcv9 -a -f sparcv9/twtchc ]
then
	echo " 64 bit ...\\c"
	cp sparcv9/twtchc /usr/kernel/drv/sparcv9
fi
if grep -s twtchc /etc/devlink.tab >/dev/null
then
    :
else
	echo " devlink.tab entry ...\\c"
	echo 'type=ddi_pseudo;name=twtchc	twtchc' >>/etc/devlink.tab
fi
echo " running add_drv ...\\c"
/usr/sbin/add_drv -m "* 0600 root root" twtchc >/dev/null 2>&1
if [ $? = 1 ];
then
	/usr/sbin/rem_drv twtchc
	/usr/sbin/add_drv -m "* 0600 root root" twtchc
fi
echo "."
exit 0

