#!/bin/sh
#
#
#ident "@(#)preinstall   1.1     99/09/07 SMI"
#
# Copyright (c) 1999 by Sun Microsystems, Inc.
#
#

#
# we assume:
#
# $CLIENT_BASEDIR	set to $BASEDIR with $PKG_INSTALL_ROOT stripped off
#

#echo "begin with the $0 script"
eval=0

seterr() {
	if [ "$1" -gt "$eval" ]; then
		eval=$1
	fi
}

errout() {
	seterr $1
	#echo "done with the $0 script, exiting with $eval"
	exit $eval
}

#
trap 'echo "$0: Caught Signal"; errout 3' 1 2 3


# warn if /usr/opt is not in same filesystem as /usr
if [ -d $BASEDIR/usr/opt ]; then
	OPTFS=`/usr/sbin/df -k $BASEDIR/usr/opt | awk 'NR == 2 { print $NF }'`
	USRFS=`/usr/sbin/df -k $BASEDIR/usr     | awk 'NR == 2 { print $NF }'`
	#echo "\$OPTFS = $OPTFS"
	#echo "\$USRFS = $USRFS"
	if [ "$OPTFS" != "$USRFS" ]; then
		echo "WARNING: \$OPTFS != $USRFS"
		seterr 2
	fi
fi

errout 0
