#!/bin/sh
#
# @(#)install_TAAC 1.1 90/02/08
#
cat << EOF

This patch is only necessary if you have installed the unbundled
TAAC product on a system running 4.1. The unbundled TAAC product
contains an earlier version of the taac.o driver file which does
not work properly with 4.1.

This script replaces the taac.o kernel driver files on your system with
the 4.1 version. It assumes your kernel object files are in
/usr/kvm/sys or /export/exec/kvm/sun*.sunos.4.1/sys, which is where
SunInstall leaves them.  If you have installed the kernel objects for
this machine or its clients (if any) in a "non-standard" location, you
will have to modify this script (or duplicate its actions by hand)
yourself.

EOF

ARCH=`arch -k`
SUNOS=4.1
ARCHLIST="sun3 sun3x sun4"

#
# return "yes" or "no" into shell variable named $1.  $2 is the user prompt.
# $3 is the default answer to use
#
get_yesno () {
    yesno=""
    while [ ! "$yesno" ]
    do
        echo ""
        echo -n "$2 [yes|no]($3)? "
        read yesno
        case "$yesno" in
        [yY]*)  yesno=yes ;;
        [nN]*)  yesno=no ;;
	"")	yesno="$3" ;;
        *)      echo "" ; echo 'Please enter "Yes" or "No".' ; yesno="" ;;
        esac
    done
    eval $1="$yesno"
}
 
get_yesno result "Continue" yes
if [ $result = no ]; then
	exit 0
fi

fullpath=/usr/kvm/sys/${ARCH}/OBJ/taac.o
if [ -f $fullpath -a -f taac.o.${ARCH} ]; then
	get_yesno result "Replace this machine's taac.o" yes
	if [ $result = yes ]; then
		cp taac.o.${ARCH} $fullpath
	fi
fi
	
for a in ${ARCHLIST}
do
	fullpath=/export/exec/kvm/${a}.sunos.${SUNOS}/sys/${a}/OBJ/taac.o
	if [ -f $fullpath ]; then
		get_yesno result "Replace taac.o for ${a}" yes
		if [ $result = yes ]; then
			cp taac.o.${a} $fullpath
		fi
	fi
done

cat <<EOF

Now reconfigure a kernel for each workstation with a TAAC board.

EOF
exit 0
