#!/bin/sh
#<copyright>
# ----------------------------------------------------------
# Sun Proprietary/Confidential Code
# Copyright 2001, Sun Microsystems, Inc. All rights reserved.
# ----------------------------------------------------------
#</copyright>

# No english directories should be in the L18N hierarchy
if test -x "/bin/rm"; then
  /bin/rm -rf /opt/SUNWstade/Lang/System/EGrid/en
  /bin/rm -rf /opt/SUNWstade/Lang/System/Labels/en
  /bin/rm -rf /opt/SUNWstade/Lang/System/Navigation/en
  /bin/rm -rf /opt/SUNWstade/Lang/System/Tests/en
  /bin/rm -rf /opt/SUNWstade/Lang/htdocs/Help/en
  /bin/rm -rf /opt/SUNWstade/Lang/htdocs/en
fi

found=N
#/usr/perl5/5.00503/bin/perl
for p in "/usr/bin/perl" "/bin/perl" "/usr/local/bin/perl" "/opt/bin/perl" 
do
  if test $found = "N"; then
    if test -x $p; then
      perl=$p
      v=`$p -e '$x=$]; print $x*1000'`
      if test "0$v" -ge "05005" ; then
        found="Y"
      fi
    fi
  fi
done

if test $found = "N" ; then
  LOOP=Y
  echo "Cannot find a version of perl that is greater then 5.005"
  echo ""
  while test "$LOOP" = "Y"
  do
   echo "Enter a path to perl or quit [q]: \c"
   read perl 
   if test "$perl" = "q" 
   then
     echo " "
     echo " ******************* ERROR *************************************"
     echo " No version of perl greater then 5.005 could be found. "
     echo " ******************* HELP **************************************"
     echo " If only the Perl binaries need to be acquired, be sure to select"
     echo " the appropriate operating system."
     echo " The Perl source is generic for the individual operating system"
     echo " types and will have to be compiled."
     echo " The following URL can assist with getting Perl 5.005 or better."
     echo " http://www.perl.com/pub/language/info/software.html"
     echo " ***************************************************************"
     exit 1;
   fi
   if test "$perl" = ""
   then
      echo "Warning: You must enter a perl path!"
      echo ""
  
   elif test -x $perl
   then
      v=`$perl -e 'print $]'`;
      if test "0$v" -ge "05.00500" ; then
        LOOP=N
      else
        echo "This perl '$perl' is too old ($v) !"
      fi
   else
      echo "The path '$perl' cannot be executed!"
      echo ""
   fi
  done
fi

$perl /opt/SUNWstade/bin/fix_perl_path $perl
$perl /opt/SUNWstade/bin/ras_install.exe $*
