#ident	"@(#)pkg.perf:perf/INSTALL	1.9"
#
#	@(#)INSTALL	1.1
#

INSPATH=/install/new
PATH30=/install/3.0
PATH31=/install/3.1
SAPATH=/usr/lib/sa
PKGNAME=`cat ${INSPATH}/usr/options/perf.name`

echo "Installing the ${PKGNAME}"
echo "Copyright (c) 1984,1987,1988 AT&T"
echo "All Rights Reserved"

#
#	Determine how much space is needed by usr and root.
#

USRneeds=`expr "\`du -s ${INSPATH}/usr\`" : "\([0-9]*\).*"`
ROOTneeds=`expr "\`du -s ${INSPATH}/\`" : "\([0-9]*\).*"`
ROOTneeds=`expr ${ROOTneeds} - ${USRneeds}`

#
#	Determine how much space is available.
#

USRspace=`expr "\`df /usr 2>/dev/null\`" : '.*: *\([0-9]*\)'`
ROOTspace=`expr "\`df / 2>/dev/null\`" : '.*: *\([0-9]*\)'`

#
#	Determine if the pagkage fits.
#

if
	[ ${USRspace} -lt ${USRneeds} ]
then
	echo "**ERROR**  ${PKGNAME} cannot be installed --"
	echo "Not enough space on the hard disk."
	echo "There are ${USRspace} blocks available on the"
	echo "/usr file system --"
	echo "${USRneeds} blocks are needed."
	exit
elif
	[ ${ROOTspace} -lt ${ROOTneeds} ]
then
	echo "**ERROR**  ${PKGNAME} cannot be installed --"
	echo "Not enough space on the hard disk."
	echo "There are ${ROOTspace} blocks available on the"
	echo "/ (root) file system --"
	echo "${ROOTneeds} blocks are needed."
	exit
fi

#
# 	Check if package was ever installed on the system
#	if so move sadc to Osadc .
#

if
	[ -f /usr/options/perf.name ]
then
	mv ${SAPATH}/sadc ${SAPATH}/Osadc
fi

#
#	Install the package.
#

cd ${INSPATH}
echo "The following files are being installed: "
find . -print | cpio -pduvm /
#

#
#	Check for release 3.0 
#
if
	[ `uname -r` = "3.0" ]
then
	cd ${PATH30}
	find . -print | cpio -pdum / 2>/dev/null
fi
#
#	Check for release 3.1 
#
if
	[ `uname -r` = "3.1" ]
then
	cd ${PATH31}
	find . -print | cpio -pdum / 2>/dev/null
fi
/install/install/setup
rm -rf ${SAPATH}/Osadc
echo "Installation of the ${PKGNAME} complete. "
echo
echo 'Execute "shutdown -i6 -g0 -y" and'
echo 'wait for the "Console Login:" prompt.'
