#! /bin/sh
# @(#) postinstall 97/07/29 7.1.3.2    97/07/31    Copyright 1993,94,95,96 Performance Technologies, Inc.
# Postinstall script for PTIptisp

# see the preinstall script for comments explaining what is going
# on here with respect to the 2.3/2.4 stuff.

# 2.3, 2.4, 2.5, 2.6 introduced changes in the SCSI HA <-> kernel API
# thus we have 3 different drivers:
# one for 2.3 and below and one for 2.4 and one for 2.5 and above

# tell the pkg database that $BASEDIR/ptisp
# is a file associated with our pkg.
# man pages/hard copy doc says to do this before creating the file.

installf $PKGINST $BASEDIR/ptisp f 0755 root sys || exit 2

minor_rev=`uname -r | awk -F. '{print $2}'` || exit 2

# RRD 7/7/97 
# No need to blow anything away anymore... clean install right now
if [ $minor_rev -le 3 ]; then
	cp $BASEDIR/ptisp.2.3 $BASEDIR/ptisp || exit 2
elif [ $minor_rev -eq 4 ]; then
	cp $BASEDIR/ptisp.2.4 $BASEDIR/ptisp || exit 2
elif [ $minor_rev -eq 5 ]; then
	cp $BASEDIR/ptisp.2.5 $BASEDIR/ptisp || exit 2
else 
	cp $BASEDIR/ptisp.2.6 $BASEDIR/ptisp || exit 2
fi

# tell the pkg database that we are done playing with the pkg's contents

installf -f $PKGINST || exit 2

# remove the $BASEDIR/ptisp.2.[3456] files since we don't need them anymore

removef $PKGINST $BASEDIR/ptisp.2.3 $BASEDIR/ptisp.2.4 $BASEDIR/ptisp.2.5 $BASEDIR/ptisp.2.6 |
while read zapit
	do
	rm -f $zapit
	done

# tell the pkg database that we are done playing with the pkg's contents

removef -f $PKGINST || exit 2

# Save basedir
SAVEBASE=$BASEDIR
BASEDIR=""; export BASEDIR

# execute the add_drv command

/usr/sbin/add_drv -m '* 0666 bin bin' -i 'PTI,ptisp ptisp PTIX,isptwo'\
    -c scsi ptisp

# Check status, restore BASEDIR and return status
STATUS=$?
BASEDIR=$SAVEBASE; export BASEDIR
if [ $STATUS -eq 0 ]
then
#
# Tell the user to reboot the machine
#
cat <<END_TEXT

>>>> IMPORTANT NOTICE <<<<
>>>> IMPORTANT NOTICE <<<<
>>
>>      Reboot `uname -n` before using the DECptisp driver. If you
>>      are installing the DEChsz70 package next, then the reboot
>>      at the end of that installation will suffice.
>>       
>>>> IMPORTANT NOTICE <<<<
>>>> IMPORTANT NOTICE <<<<
END_TEXT
        exit 0
else
        exit 2
fi
