#!/bin/ksh
# set -x
#
# This is the post-patch section
#

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

PKGNAME="SUNWssmi"

if [ -r /etc/opt/$PKGNAME/ENV ]
then
   grep -v "PATCH_LEVEL" /etc/opt/$PKGNAME/ENV >> /etc/opt/$PKGNAME/ENV.tmp
   mv /etc/opt/$PKGNAME/ENV.tmp /etc/opt/$PKGNAME/ENV
   echo "PATCH_LEVEL=2" >> /etc/opt/$PKGNAME/ENV
else
   echo "$PKGNAME environment file is missing. This indicates a errorcondition"
   echo "in $PKGNAME, but it won't affect the installation of this patch but"
   echo "not being able to update this file with the entry:"
   echo ""
   echo "PATCH_LEVEL=2"
   echo ""
   echo "If you have moved this file to another location, please include"
   echo "the line above, for proper functionality."
fi

if [ -f "/tmp/$PKGNAME_RESTART.$PPID" ]
then
   echo "Restarting $PKGNAME."
   /opt/$PKGNAME/sbin/Boot && sleep 20
else
   echo "Warning! You have to activate $PKGNAME manually."
fi
