trap 'exit 3' 15

#+

postremovestat=0

AB2DIR=`pkgparam SUNWab2u BASEDIR`
AB2BIN=${AB2DIR}/lib/ab2/bin

export AB2BIN

#-

if [ -x ${AB2BIN}/ab2admin ]
then

   cmd="${AB2BIN}/ab2admin -o uninstall -n ${PKGINST}"

   eval $cmd

   if [ "$?" -ne 0 ]
   then
	echo "WARNING: postremove failed to remove the AB-2 database record"
	echo "for the collection associated with this package."
	echo "This means:"
	echo "The files of this collection have been physically removed,"
	echo "but there may still be a reference to this collection in the "
	echo "local AB-2 collection database."
   else
	cmd1="${AB2BIN}/ab2admin -o stop"
	cmd2="${AB2BIN}/ab2admin -o start"
	echo "Restarting the server"
	echo "$cmd1"
	eval $cmd1
	echo "$cmd2"
	eval $cmd2
   fi
else
   echo "WARNING: Can't see ${AB2BIN}/ab2admin , the AnswerBook2 admin utility,"
   echo "on this machine!"
   echo "apparently this AB-2 collection has resided on a file server which "
   echo "does not have the AB-2 admin binaries."
   echo ""
fi

exit $postinstallstat
