#!/sbin/sh
################################################################
# HP TSC mods for IPHASE 4811
# 1/3/96 MK 
# 8/28/96 multiple seah.o compiled for different OS's (eg 10.00/01/10)
# 
# 10.xx only
################################################################


#file includes  mods from HP TSC 
# THIS MAY NO LONGER WORK ON 9.0X

UTILS=/usr/lbin/sw/control_utils
if [[ ! -f $UTILS ]]
then
    print "ERROR:   Cannot find $UTILS."
    exit 1
fi
. $UTILS

# cover all the bases
PATH=$SW_PATH:$PATH:/usr/bin:/sbin:/usr/ccs/bin
SAMDRIVERS=/usr/sam/lib/kc/drivers.tx
set +m

OSREV=`uname -r`
OSTYPE=`uname -m`
case "$OSTYPE" in

    9000/7* | 9000/8*)

     #Check for eisa driver in the kernel

     grep eisa /stand/system >/dev/null 2>&1

     if [ $? -eq 1 ]
       then
         echo "ERROR:   The eisa driver is not configured in the kernel"
         exit $FAILURE
     fi

     #Check for lan2 driver in the kernel 6/03/96
 
     grep lan2 /stand/system >/dev/null 2>&1
 
     if [ $? -eq 1 ]
       then
         echo "The lan2 driver is not in the kernel, adding to /stand/system"
         echo "lan2" >> /stand/system
     fi

     # Add seah entry to /stand/system file

     grep seah /stand/system >/dev/null 2>&1

     if [ $? -eq 1 ]
       then
         echo "seah" >> /stand/system
     fi

     # Add our obj file to the libusrdrv archive, WARNING assumes if B.10.00 then all exist
     if [ -r /tmp/seah.o.B.10.00 ]
       then
		case "$OSREV" in

			B.10.20*)
				echo "using object file: seah.o.B.10.20"
				cp -f /tmp/seah.o.B.10.20 /tmp/seah.o
        		ar -r /usr/conf/lib/libusrdrv.a /tmp/seah.o
			;;
			B.10.10*)
				echo "using object file: seah.o.B.10.10"
				cp -f /tmp/seah.o.B.10.10 /tmp/seah.o
        		ar -r /usr/conf/lib/libusrdrv.a /tmp/seah.o
			;;
			B.10.01*)
				echo "using object file: seah.o.B.10.01"
				cp -f /tmp/seah.o.B.10.01 /tmp/seah.o
        		ar -r /usr/conf/lib/libusrdrv.a /tmp/seah.o
			;;
			B.10.00*)
				echo "using object file: seah.o.B.10.00"
				cp -f /tmp/seah.o.B.10.00 /tmp/seah.o
        		ar -r /usr/conf/lib/libusrdrv.a /tmp/seah.o
			;;
			*)
				echo "OS rev unknown, using default file: seah.o.B.10.00"
				cp -f /tmp/seah.o.B.10.00 /tmp/seah.o
        		ar -r /usr/conf/lib/libusrdrv.a /tmp/seah.o
			;;
		esac

#		if [ $OSREV = "B.10.00" ]
#			then
#				cp -f /tmp/seah.o.B.10.00 /tmp/seah.o
#        		ar -r /usr/conf/lib/libusrdrv.a /tmp/seah.o
#			else
#				echo "seah.o.B.10.00 NOT copied"
#		fi
#		if [ $OSREV = "B.10.10" ]
#			then
#				cp -f /tmp/seah.o.B.10.10 /tmp/seah.o
#        		ar -r /usr/conf/lib/libusrdrv.a /tmp/seah.o
#			else
#				echo "seah.o.B.10.10 NOT copied"
#		fi

	/usr/bin/chmod 444 /usr/conf/lib/libusrdrv.a
	/usr/bin/chown bin /usr/conf/lib/libusrdrv.a
	/usr/bin/chgrp bin /usr/conf/lib/libusrdrv.a
        rm -f /tmp/seah.o*
       else
         echo "ERROR:   /tmp/seah.o.B.10.00 missing, could not modify libusrdrv.a"
        exit $FAILURE
      fi
    ;;

    *)	

    echo "Model $OSTYPE not supported at this time"
    exit1
    ;;

esac
exit $SUCCESS
}
