#! /bin/sh

# Script that stops powerd before restore.
#

kill_powerd() {  

#
# Bypass killing powerd if not on client.
#

if [ "$ROOTDIR" = "/" ]
then

    CHK_POWERD=`pgrep -x powerd`
    echo
    echo "If /usr/lib/powerd/powerd is running, it will be stopped before "
    echo "patch backout can commence." 
    echo
    
    if [ -n "$CHK_POWERD" ]
    then
         kill $CHK_POWERD
         sleep 10
         CHK_KILL=`pgrep -x powerd`
         if [ -n "$CHK_KILL" ]
         then
           echo
           echo
           echo "Warning:  Kill powerd may have failed.  See patch README."
           echo

         fi
    fi

fi

}


pkginfo -q SUNWpmu > /dev/null 2>$1
pmu_sys=$?

[ $pmu_sys -ne 0 ] && exit 0

kill_powerd
