:
#      @(#)nfs	5.4.1.2 Lachman System V STREAMS TCP  source
#      SCCS IDENTIFICATION
#
#	System V STREAMS TCP - Release 4.0
#
#	Copyright 1987, 1988, 1989 Lachman Associates, Incorporated (LAI)
#
#	All Rights Reserved.
#
#	The copyright above and this notice must be preserved in all
#	copies of this source code.  The copyright above does not
#	evidence any actual or intended publication of this source
#	code.
#
#	This is unpublished proprietary trade secret source code of
#	Lachman Associates.  This source code may not be copied,
#	disclosed, distributed, demonstrated or licensed except as
#	expressly authorized by Lachman Associates.
#
#	System V STREAMS TCP was jointly developed by Lachman
#	Associates and Convergent Technologies.
#
# 
# This script is for for reconfiguring nfs using netconfig
#
: ${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

tmp=/tmp/nfs$$

#
# Parameters used by the functions in tcp_nfs.comm
#
PRODUCT="NFS"
PERMSLIST=/etc/perms/nfsrt
LKPERM=/etc/perms/inst

#
# 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

##############################################################################
# Tidy up
#
tidyup() {
	[ "$tmp" ] && rm -r -f $tmp*
	rm -f /tmp/sco_nfs_reconf
	echo "\nNFS Reconfiguration Complete."
}

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

if [ -z "$LOWER_PRD" ] ; then
	exit $OK
fi

echo "\nNFS Reconfiguration of nfs->$LOWER_PRD"
# Invoke /usr/lib/netconfig/init/nfs script to configure in changes
> /tmp/sco_nfs_reconf	# So that init script knows its a reconfiguration

echo "\nUpdating configuration files ..."
sh /usr/lib/netconfig/init/nfs $LOWER_PRD - - - N
result=$?
if [ $result -eq 1 ] ; then
	tidyup
	cleanup $FAIL
fi
tidyup
exit $result		# Ensure kernel is relinked if necessary
