#!/bin/sh
# $Revision: 1.2 $
# Sun Packaging Request script for Netbackup FlashBackup

test_yn ()
{
case $1 in
  Y*|y*) return 0 ;;
  *)    return 1 ;;
esac
}

INSTALL_FS_DIR="/opt"
CLASSES="FSclass"
DIR=""
exit_err=0
# Prepend /usr/5bin to PATH on Suns to get System V behaviour from echo.
PATH=/usr/5bin:$PATH
#
# Check for existing NetBackup
#
if [ -f /usr/openv/netbackup/version ] ; then
    if [ -h /usr/openv ] ; then
      # find real directory
      HEREIAM=`pwd`
      cd /usr/openv
      DIR=`pwd`
      cd ${HEREIAM}
      INSTALL_FS_DIR=`dirname ${DIR}`
      echo "\n\n\tNetbackup is currently installed in ${INSTALL_FS_DIR}."
      echo "\tFlashBackup will be installed in ${INSTALL_FS_DIR}/openv/lib/client.\n\n"
    else
      echo "\n\n\tA directory /usr/openv already exists."
      echo "\tPlease move openv to a location other than /usr"
      echo "\t and create a soft-link from /usr/openv,"
      echo "\tbefore you attempt to install FlashBackup.\n\n"
      exit_err=3
    fi
else # no version file is found, stop FlashBackup install.
  echo "\n\tNetbackup must be installed before the"
  echo "\tFlashBackup can be installed.\n\n"
  exit_err=3
fi 
if [ $exit_err -eq 0 ] ; then 
  REQ_CLASS="FSSun4class"
  echo "\n\tThe Flashbackup Sun4 Libraries and Drivers will be loaded."
  CLASSES="FSclass $REQ_CLASS"
fi
#
# make parameters available to preinstall/postinstall scripts
cat > $1 <<!
INSTALL_FS_DIR='$INSTALL_FS_DIR'
BASEDIR='$INSTALL_FS_DIR'
CLASSES='$CLASSES'
!
exit $exit_err
