
# $1 - $ROOTDIR
# current directory is the patch directory
#
# do a pkgadd if SUNWjaxp is not present
#
pkginfo -q -R $1 SUNWjaxp > /dev/null
stat=$?
if [ $stat -ne 0 ]; then
#  echo "Running prePatch, SUNWjaxp is not even here"
  pkgadd -d payload -R $1 -a admin.quiet SUNWjaxp
fi

#
# if the VERSION is different between the existence
# package on the system and the package of the patch,
# installation will abbort.
#
patchdir=`pwd`

pkg_version=`pkginfo -R $1 -l SUNWjaxp |grep VERSION|awk '{print $2}'`
patch_version=`grep VERSION $patchdir/SUNWjaxp/pkginfo|sed 's/VERSION=//'`

if [ "$pkg_version" != "$patch_version" ]
then
	cat <<-eof
	Installed pkg SUNWjaxp is different from the
	one in this patch. They both must contain the same
	VERSION string as found in the pkginfo file.

	Patch install is aborting...
	eof

	exit 1
fi

