:
#      @(#)nfs	4.7.1.2 System V NFS  source
#      SCCS IDENTIFICATION
#
#	SCO Modifications: @(#)nfs	1.4 91/12/17 
#
#	Copyright (C) The Santa Cruz Operation, 1988.
#	This Module contains Proprietary Information of
#	The Santa Cruz Operation, and Lachman Associates Inc. 
#	and should be treated as Confidential.
#
#
: ${OK=0} ${FAIL=1} ${RELINK=2}
PATH=/bin:/usr/bin:/etc:/etc/conf/bin

LOWER_PRD=$1
LOWER_IF=$2
UPPER_PRD=$3
UPPER_IF=$4
CONFIGURE=$5

#
# Miscellaneous variable declarations
#
tmp=/tmp/nfs$$

#
# Parameters used by the functions in tcp_nfs.comm.
#
PRODUCT="NFS"
PERMSLIST=/etc/perms/nfsrt
LKPERM=/etc/perms/inst
DRIVERDIR=/usr/lib/nfsrt/ID
DRIVERS="nfs nfsd lockd"
SAVEDIR=""
KPARAMS="NBLK512	-16 \
	 NBLK256	-64 \
	 NBLK128	-128 \
	 NUMTIM		-16 \
	 NUMTRW		-16"
_upgrade=
_no_prompt=
_reconfig=

#
# If the common functions file doesn't exist, we won't get very far.
#
COMMONFILE=/usr/lib/netconfig/bin/tcp_nfs.comm

if [ ! -r $COMMONFILE ]
then
	echo "\nError: Missing or unreadable $COMMONFILE." >&2
	exit ${FAIL}
fi

. $COMMONFILE

##############################################################################
# main()
#
trap "cleanup $FAIL" 1 2 3 15

message "Removing $PRODUCT from the system ... \n"

cd /
if [ ${CONFIGURE} = "N" ] ; then
	message "\nRemoval of $PRODUCT complete.\n"
	cleanup $OK
fi

echo "Stopping NFS ... \c"
/etc/nfs stop 2>/dev/null 1>&2
echo "done."

#
# First remove boot time startup scripts
#
[ -x /etc/rc0.d/K79nfs ] && rm -f /etc/rc0.d/K79nfs
[ -x /etc/rc2.d/S89nfs ] && rm -f /etc/rc2.d/S89nfs

#
# Check to see that the link kit is installed, 
# since drivers cannot be removed without it.
#
_no_prompt=TRUE chklinkkit		# Inform user of link-kit status

#
# KLUDGE ALERT
# restore kludged NFS sfsys.d and mfsys.d entries
# so they get properly deleted.
#
# This was originally done to work around a bug in 3.2.0f,
# but as of 12/17/91 it still seems to be neccessary (3.2.4l).
#
cd /etc/conf/mfsys.d
mv znfs nfs
cd ../sfsys.d
mv znfs nfs
cd /
#
# END KLUDGE ALERT
#

remove_drivers			# Remove drivers
set_kernel_params		# Reset kernel parameters

#
# Remove special files so that immediate re-install will work.
#
/bin/rm -f /dev/nfsd /dev/lockd /dev/nfsd

#
# Remove other random things
#
rm -f /etc/nfs.00 /etc/nfsstat_data

message "\nRemoval of $PRODUCT complete.\n"

cleanup $RELINK
