#!/bin/sh
# $Revision: 1.2 $
# Sun Packaging Postremove script for Media Manager
#
test_yn ()
{
case $1 in
  Y*|y*) return 0 ;;
  *)	return 1 ;;
esac
}
ISABI=`env | grep NONABI_SCRIPTS`
if [ "$ISABI" = "" ] ; then
  echo "\n\tremove any non-empty directories manually\n"
  exit 0
fi
if [ -d $INSTALL_VM_DIR/openv/volmgr ] ; then
  rmdir $INSTALL_VM_DIR/openv/volmgr 2>/dev/null
  if [ $? != 0 ] ; then
    echo "\n\n\t$INSTALL_VM_DIR/openv/volmgr is not empty!"
    ans=`ckyorn -p "\tDo you want to delete $INSTALL_VM_DIR/openv/volmgr? (y)"` || exit $?
    test_yn $ans
    if [ $? = 0 ] ; then
      rm -rf $INSTALL_VM_DIR/openv/volmgr
    fi
  fi
fi
if [ ! -d $INSTALL_VM_DIR/openv/netbackup ] &&
   [ ! -d $INSTALL_VM_DIR/openv/hsm ] &&
   [ ! -d $INSTALL_VM_DIR/openv/volmgr ] &&
   [ ! -d $INSTALL_VM_DIR/openv/java ] &&
   [ ! -d $INSTALL_VM_DIR/openv/lib ] &&
   [ -d $INSTALL_VM_DIR/openv ] ; then
   rmdir $INSTALL_VM_DIR/openv 2>/dev/null
   if [ $? != 0 ] ; then
     echo "\n\n\t$INSTALL_VM_DIR/openv is not empty!"
     ans=`ckyorn -d y \
     -p "\tDo you want to delete $INSTALL_VM_DIR/openv? (y)" ` || exit $?
     test_yn $ans
     if [ $? = 0 ] ; then
       rm -rf $INSTALL_VM_DIR/openv
     fi
   fi
fi
if [ ! -d $INSTALL_VM_DIR/openv ] ; then
  rm /usr/openv
fi
