#!/usr/bin/ksh
#set -x

if [ -z "`ps -edaf | grep [b]oks`" ]
then
   echo ""
   echo "SUNWssm seems to be installed, but is not running."
   echo "This might be a problem if manual maintenence has been done."
   echo "Continue backing out patch anyway (yes/no)? \c"
   ans="dummy"
   read ans

   ans=`echo $ans | tr '[a-z]' '[A-Z]'`

   if [ "$ans" != "YES" -a "$ans" != "Y" ]
   then
      echo "Backing out patch was aborted by user."
      exit 1
   else
      echo "Continuing on users behalf."
      echo "You have to restart SUNWssm manually."
   fi
else
   echo "SUNWssm is up and running. Proceeding with backing out patch."
   echo "Stopping SUNWssm (this is normal procedure)."  

   /opt/SUNWssm/sbin/Boot -k && sleep 30
   touch /tmp/SUNWssm_RESTART.$PPID
fi

echo "========================================================================="
echo
