# $Id: rfpadmin.app,v 1.4.6.1 2004/08/12 09:12:42 jeremyc Exp $
test `uname -s` = Linux && echocmd="echo -e" || echocmd="echo"

trap '' INT

if [ ! -w /etc/passwd ]; then
   $echocmd "*** You must be root to run this script."
   $echocmd "exiting ..."
   exit 1
fi

if [ ".$COBDIR" = "." ] || [ ! -f $COBDIR/etc/cobver ]; then
   $echocmd "*** COBDIR must be set to point to a valid product."
   $echocmd "exiting ..."
   exit 1
fi

runscript()
{
   SCRIPT=$1
   if [ -f "$SCRIPT" ]; then
      sh $SCRIPT MFADMIN
   else
      $echocmd "*** Option not available. No such script."
      $echocmd "Press Return to continue."
      read _TMP
   fi
}

while [ 1 ]; do
   clear
   cat <<END

         Fixpack Administration

         1) Uninstall a Fixpack
         2) Commit a Fixpack
         q) quit

COBDIR is set to $COBDIR
END
   $echocmd "Select option (1,2,q): \c"
   read SEL
   case $SEL in
   1) runscript $COBDIR/bin/mfuninstallfp ;;
   2) runscript $COBDIR/bin/mfcommitfp    ;;
   q) exit 0                              ;;
   *) $echocmd "\n*** Invalid selection."
      $echocmd "Press Return to continue."
      read _TMP
   esac
done
