#!/sbin/sh
########################################
#  Product: HPUXOpenSSL
#  Fileset: Latest
#  postremove
#  (c) Copyright Hewlett-Packard Company
####################################
UTILS="/usr/lbin/sw/control_utils"
    if [[ ! -f $UTILS ]]
    then
        echo "ERROR: Cannot find $UTILS"
        exit 1
    fi
    . $UTILS
exitval=$SUCCESS
####################################
# Remove Directories
####################################
	
#kill_named_procs prngd KILL 1>/dev/null 2>/dev/null

if [ -d /opt/openssl/fips/0.9.7 ]; then
cd /opt/openssl/fips/0.9.7
if [ $? -eq 0 ]; then

rm -rf old >/dev/null 2>&1

if [ ! -a /opt/openssl/fips/0.9.7/old ]; then
  mkdir old > /dev/null 2>&1
  chmod 555 old > /dev/null 2>&1
  chown bin:bin old > /dev/null 2>&1
fi

for dirs in `ls /opt/openssl/fips/0.9.7`; do
  if [ ${dirs} = "old" -o ${dirs} = "openssl.cnf" ]; then
     continue
  fi
  rm -rf ${dirs} > /dev/null 2>&1
  if [ -a /opt/openssl/fips/0.9.7/${dirs} ]; then
     mv ${dirs} old/${dirs}_$$ >/dev/null 2>&1
  fi
done

rm -rf old >/dev/null 2>&1

cd - >/dev/null 2>&1
fi  #### check if cd /opt/openssl/fips/0.9.7 is successful
fi  #### check if -d /opt/openssl/fips/0.9.7

####################################
exit $exitval
####################################
