Changeset 19355


Ignore:
Timestamp:
2009-05-08T21:38:04+12:00 (15 years ago)
Author:
ak19
Message:

Moved finding java and finding perl logic into findjava.sh and findperl.sh. Findjava.sh is called from gli.sh and client-gli.sh. Still need to call findperl.sh from client-gli.sh, and need to split findgsdl into its own file. Tested.

Location:
gli/trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • gli/trunk/client-gli.sh

    r19313 r19355  
    6868fi
    6969
    70 
    71 ## ---- Check Java exists ----
    72 javapath=
    73 
    74 # Some users may set the above line manually
    75 if [ "x$javapath" = "x" ]; then
    76 
    77     # If it is set, use the JAVA_HOME environment variable
    78     if [ "x$JAVA_HOME" != "x" ]; then
    79     javapath="$JAVA_HOME/bin/java"
    80 
    81     # Check if Java is on the search path
    82     else
    83     javapath=`which java 2> /dev/null`
    84     fi
    85 fi
    86 
    87 # Check that a Java executable has been found
    88 if [ "$glilang" = "es" ]; then
    89     echo "Revisando Java: $javapath"
    90 elif [ "$glilang" = "fr" ]; then
    91     echo "Vérification de Java: $javapath"
    92 elif [ "$glilang" = "ru" ]; then
    93     echo "ðÒÏ×ÅÒËÁ Java: $javapath"
    94 else
    95     echo "Checking Java: $javapath"
    96 fi
    97 if [ ! -x "$javapath" ]; then
    98     echo
    99     if [ "$glilang" = "es" ]; then
    100     echo "No se pudo localizar una versión apropiada de Java. Usted deberá "
    101     echo "instalar un Ambiente de Ejecución Java (versión 1.4 o superior) "
    102     echo "antes de correr la Interfaz de la $PROGFULLNAME                    ."
    103     elif [ "$glilang" = "fr" ]; then
    104     echo "Une version adéquate de Java n'a pas pu être localisée."
    105     echo "Vous devez installer un Java Runtime Environment (version 1.4 ou"
    106     echo "supérieur) avant de démarrer $PROGNAME Librarian Interface."
    107     elif [ "$glilang" = "ru" ]; then
    108     echo "îÅ ÕÄÁÌÏÓØ ÏÐÒÅÄÅÌÉÔØ ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÅ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÊ ×ÅÒÓÉÉ Java."
    109     echo "÷Ù ÄÏÌÖÎÙ ÕÓÔÁÎÏ×ÉÔØ Java Runtime Environment (×ÅÒÓÉÀ 1.4 ÉÌÉ ×ÙÛÅ)"
    110     echo "ÐÅÒÅÄ ××ÏÄÏÍ ÂÉÂÌÉÏÔÅÞÎÏÇÏ ÉÎÔÅÒÆÅÊÓÁ $PROGNAME."
    111     else
    112     echo "Failed to locate an appropriate version of Java. You must install a"
    113     echo "Java Runtime Environment (version 1.4 or greater) before running the"
    114     echo "$PROGNAME Librarian Interface."
    115     fi
    116     exit 1
    117 fi
    118 
    119 
    120 ## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
    121 `$javapath -classpath . CheckJavaVersion > /dev/null`
    122 if [ $? -ne 2 ] ; then
    123     echo
    124     if [ "$glilang" = "es" ]; then
    125     echo "La versión del Ambiente de Ejecución Java (JRE por sus siglas en "
    126     echo "inglés) que usted tiene instalada es demasiado vieja para ejecutar "
    127     echo "la Interfaz de la Biblioteca Digital Greenstone. Por favor instale "
    128     echo "una nueva versión del Ambiente de Ejecución Java (versión 1.4 o "
    129     echo "posterior) y ejecute nuevamente este guión."
    130     elif [ "$glilang" = "fr" ]; then
    131     echo "La version de Java Runtime Environment que vous avez installée est"
    132     echo "trop vielle pour faire fonctionner Greenstone Librarian Interface."
    133     echo "Veuillez installer une nouvelle version du JRE (version 1.4 ou plus"
    134     echo "récente) et redémarrez le script."
    135     elif [ "$glilang" = "ru" ]; then
    136     echo "÷ÅÒÓÉÑ Java Runtime Environment, ËÏÔÏÒÕÀ ÷Ù ÕÓÔÁÎÏ×ÉÌÉ, ÏÞÅÎØ ÓÔÁÒÁ,"
    137     echo "ÞÔÏÂÙ ÕÐÒÁ×ÌÑÔØ ÂÉÂÌÉÏÔÅÞÎÙÍ ÉÎÔÅÒÆÅÊÓÏÍ Greenstone. ðÏÖÁÌÕÊÓÔÁ, "
    138     echo "ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ JRE (×ÅÒÓÉÀ 1.4 ÉÌÉ ÂÏÌÅÅ ÎÏ×ÕÀ) É"
    139     echo "ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ"
    140     else
    141     echo "The version of the Java Runtime Environment you have installed is too"
    142     echo "old to run the Greenstone Librarian Interface. Please install a new"
    143     echo "version of the JRE (version 1.4 or newer) and rerun this script."
    144     fi
    145     exit 1
     70## ---- findJava ----
     71# call the script with source, so that we have the variables it sets ($javapath)
     72exit_status=0
     73source ./findjava.sh
     74exit_status=$?
     75if [ "$exit_status" -eq 1 ]; then
     76    exit 1;
    14677fi
    14778
  • gli/trunk/gli.sh

    r19171 r19355  
    232232echo
    233233
    234 ##  ---- Check Perl exists ----
    235 perlpath=
    236 
    237 # Some users may set the above line manually
    238 if [ "x$perlpath" = "x" ]; then
    239     # Check if Perl is on the search path
    240     perlpath=`which perl 2> /dev/null`
    241 fi
    242 
    243 # Check that a Perl executable has been found
    244 echo "Perl:"
    245 if [ ! -x "$perlpath" ] ; then
    246     echo
    247     if [ "$glilang" = "es" ]; then
    248     echo "La Interfaz de la $PROGNAME requiere Perl para "
    249     echo "poder operar, pero éste no aparece en su sistema. Por favor asegúrese "
    250     echo "de que Perl está instalado y se encuentra en su ruta de búsqueda. A "
    251     echo "continuación ejecute nuevamente este guión."
    252     elif [ "$glilang" = "fr" ]; then
    253     echo "$PROGNAME nécessite Perl pour son fonctionnement,"
    254     echo "mais perl n'a pas pu être détecté dans votre système. Veuillez vous "
    255     echo "assurer que perl est installé et est spécifié dans votre chemin de "
    256     echo "recherche, puis redémarrez ce script."
    257     elif [ "$glilang" = "ru" ]; then
    258     echo "âÉÂÌÉÏÔÅÞÎÙÊ $PROGNAME ÔÒÅÂÕÅÔ Perl, ÞÔÏÂÙ ÉÍÅÔØ ×ÏÚÍÏÖÎÏÓÔØ"
    259     echo "ÒÁÂÏÔÁÔØ, ÎÏ Perl ÎÅ ÂÙÌ × ×ÁÛÅÊ ÓÉÓÔÅÍÅ. ðÏÖÁÌÕÊÓÔÁ, ÐÏÄÔ×ÅÒÄÉÔÅ, ÞÔÏ "
    260     echo "Perl ÕÓÔÁÎÏ×ÌÅÎ É ÎÁÈÏÄÉÔÓÑ ÎÁ ×ÁÛÅÍ ÐÕÔÉ ÐÏÉÓËÁ, ÚÁÔÅÍ ÐÏ×ÔÏÒÎÏ××ÅÄÉÔÅ"
    261     echo "ÜÔÏÔ ÓËÒÉÐÔ."
    262     else
    263     echo "The $PROGNAME requires Perl in order to operate,"
    264     echo "but perl could not be detected on your system. Please ensure that perl"
    265     echo "is installed and is on your search path, then rerun this script."
    266     fi
    267     exit 1
    268 fi
    269 echo $perlpath
    270 echo
     234## ---- find perl ----
     235exit_status=0
     236./findperl.sh
     237exit_status=$?
     238if [ "$exit_status" -eq 1 ]; then
     239    exit 1;
     240fi
    271241
    272242## ---- Check Java ----
    273 echo "Java:"
    274 MINIMUM_JAVA_VERSION=1.4.0_00
    275 
    276 # Some users may set this line manually
    277 #JAVA_HOME=
    278 
    279 if [ -z "$javapath" ]; then
    280 
    281     # sus out search4j
    282     if [ "$_version" -eq 2 -a -e "$GSDLHOME/bin/$GSDLOS/search4j" ]; then
    283         SEARCH4J_EXECUTABLE=$GSDLHOME/bin/$GSDLOS/search4j
    284     elif [ "$_version" -eq 3 -a -e "$GSDL3SRCHOME/bin/$GSDLOS/search4j" ]; then
    285         SEARCH4J_EXECUTABLE=$GSDL3SRCHOME/bin/search4j
    286     elif [ -e "../bin/$GSDLOS/search4j" ]; then
    287         SEARCH4J_EXECUTABLE=../bin/$GSDLOS/search4j
    288     elif [ -e "../bin/search4j" ]; then
    289         SEARCH4J_EXECUTABLE=../bin/search4j
    290     else
    291         echo "Couldn't determine the location of the search4j executable"
    292         echo "If you are running Greenstone2"
    293         echo "   * check GSDLHOME is set"
    294         echo "   * check bin/$GSDLOS/search4j exists"
    295         echo "   * check bin/$GSDLOS/search4j is executable"
    296         echo "If you are running Greenstone3"
    297         echo "   * check GSDL3SRCHOME is set"
    298         echo "   * check bin/search4j exists"
    299         echo "   * check bin/search4j is executable"
    300         echo "   * try running 'ant compile-search4j'"
    301     fi
    302 
    303     # Give search4j a hint to find Java depending on the platform
    304     if [ $GSDLOS = linux ]; then
    305         HINT=`cd ..;pwd`/packages/jre
    306     elif [ $GSDLOS = darwin ]; then
    307         HINT=/System/Library/Frameworks/JavaVM.framework/Home
    308     fi 
    309    
    310     javapath="`"$SEARCH4J_EXECUTABLE" -e -p "$HINT" -m $MINIMUM_JAVA_VERSION`"
    311 
    312     if [ "$?" != "0" ]; then
    313 
    314         OLDVER="`"$SEARCH4J_EXECUTABLE" -v -p "$HINT"`"
    315 
    316         if [ "$?" = "0" ]; then
    317 
    318             if [ "$glilang" = "es" ]; then
    319                 echo "La versión del Ambiente de Ejecución Java (JRE por sus siglas en "
    320                 echo "inglés) que usted tiene instalada es demasiado vieja para ejecutar "
    321                 echo "la Interfaz de la $PROGNAME. Por favor instale "
    322                 echo "una nueva versión del Ambiente de Ejecución Java (versión $MINIMUM_JAVA_VERSION o "
    323                 echo "posterior) y ejecute nuevamente este guión."
    324             elif [ "$glilang" = "fr" ]; then
    325                 echo "La version de Java Runtime Environment que vous avez installée est"
    326                 echo "trop vielle pour faire fonctionner $PROGNAME."
    327                 echo "Veuillez installer une nouvelle version du JRE (version $MINIMUM_JAVA_VERSION ou plus"
    328                 echo "récente) et redémarrez le script."
    329             elif [ "$glilang" = "ru" ]; then
    330                 echo "÷ÅÒÓÉÑ Java Runtime Environment, ËÏÔÏÒÕÀ ÷Ù ÕÓÔÁÎÏ×ÉÌÉ, ÏÞÅÎØ ÓÔÁÒÁ,"
    331                 echo "ÞÔÏÂÙ ÕÐÒÁ×ÌÑÔØ ÂÉÂÌÉÏÔÅÞÎÙÍ $PROGNAME. ðÏÖÁÌÕÊÓÔÁ, "
    332                 echo "ÕÓÔÁÎÏ×ÉÔÅ ÎÏ×ÕÀ ×ÅÒÓÉÀ JRE (×ÅÒÓÉÀ $MINIMUM_JAVA_VERSION ÉÌÉ ÂÏÌÅÅ ÎÏ×ÕÀ) É"
    333                 echo "ÐÅÒÅÕÓÔÁÎÏ×ÉÔÅ ÜÔÏÔ ÓËÒÉÐÔ"
    334             else
    335                 echo "The version of the Java Runtime Environment you have installed ($OLDVER)"
    336                 echo "is too old to run the $PROGNAME. Please install a new"
    337                 echo "version of the JRE (version $MINIMUM_JAVA_VERSION or newer) and rerun this script."
    338             fi
    339             exit 1
    340 
    341         else
    342 
    343             echo
    344             if [ "$glilang" = "es" ]; then
    345                 echo "No se pudo localizar una versión apropiada de Java. Usted deberá "
    346                 echo "instalar un Ambiente de Ejecución Java (versión $MINIMUM_JAVA_VERSION o superior) "
    347                 echo "antes de correr la Interfaz de la $PROGNAME."
    348             elif [ "$glilang" = "fr" ]; then
    349                 echo "Une version adéquate de Java n'a pas pu être localisée."
    350                 echo "Vous devez installer un Java Runtime Environment (version $MINIMUM_JAVA_VERSION ou"
    351                 echo "supérieur) avant de démarrer $PROGNAME."
    352                 echo "Si vous avez Java installé sur votre ordinateur veuillez vérifier la variable"
    353                 echo "d'environnement JAVA_HOME."
    354             elif [ "$glilang" = "ru" ]; then
    355                 echo "îÅ ÕÄÁÌÏÓØ ÏÐÒÅÄÅÌÉÔØ ÍÅÓÔÏÎÁÈÏÖÄÅÎÉÅ ÓÏÏÔ×ÅÔÓÔ×ÕÀÝÅÊ ×ÅÒÓÉÉ Java."
    356                 echo "÷Ù ÄÏÌÖÎÙ ÕÓÔÁÎÏ×ÉÔØ Java Runtime Environment (×ÅÒÓÉÀ $MINIMUM_JAVA_VERSION ÉÌÉ ×ÙÛÅ)"
    357                 echo "ÐÅÒÅÄ ××ÏÄÏÍ ÂÉÂÌÉÏÔÅÞÎÏÇÏ $PROGNAME."
    358             else
    359                 echo "Failed to locate an appropriate version of Java. You must install a"
    360                 echo "Java Runtime Environment (version $MINIMUM_JAVA_VERSION or greater) before running the"
    361                 echo "$PROGNAME."
    362                 echo "If you have Java intalled on your machine please set the environment variable JAVA_HOME."
    363             fi
    364         fi
    365 
    366     fi
    367 
    368 fi
    369 echo $javapath
    370 echo
    371 
    372 
    373 ## -- Check the version of Java is new enough (1.4.0 or higher) to run the GLI --
    374 `"$javapath" -classpath . CheckJavaVersion > /dev/null`
    375 if [ $? -ne 2 ] ; then
    376     echo
     243# call the script with source, so that we have the variables it sets ($javapath)
     244exit_status=0
     245source ./findjava.sh
     246exit_status=$?
     247if [ "$exit_status" -eq 1 ]; then
     248    exit 1;
    377249fi
    378250
Note: See TracChangeset for help on using the changeset viewer.