Changeset 17442

Show
Ignore:
Timestamp:
02.10.2008 09:22:14 (11 years ago)
Author:
oranfry
Message:

search4j calls changed to use priority hint rather than regular hint in gs3-setup.x files. Plus a lot of whitespace fixes in the sh one.

Location:
greenstone3/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • greenstone3/trunk/gs3-setup.bat

    r15363 r17442  
    4747 
    4848:: ---- Search for java ---- 
    49 winutil\search4j.exe -m %java_min_version% | winutil\setvar.exe _JRE_HOME > %TMP%\set_jre_home.bat 
     49winutil\search4j.exe -p %CD%/packages/jre -m %java_min_version% | winutil\setvar.exe _JRE_HOME > %TMP%\set_jre_home.bat 
    5050call %TMP%\set_jre_home.bat 
    5151del %TMP%\set_jre_home.bat 
  • greenstone3/trunk/gs3-setup.sh

    r16213 r17442  
    44#the purpose of this file is to check/set up the environment for greenstone3 
    55#sorts out: 
    6 #   - gsdl3home 
    7 #   - java 
     6#  - gsdl3home 
     7#  - java 
    88 
    99# java_min_version gets passed to search4j as the minimum java version 
     
    2323 
    2424  if test -n "$gsdl_not_sourced" ; then 
    25      echo " Error: Make sure you source this script, not execute it. Eg:" 
    26      echo "     $ source gs3-setup.sh" 
    27      echo " or" 
    28      echo "     $ . gs3-setup.sh" 
    29      echo " not" 
    30      echo "     $ ./gs3-setup.sh" 
     25     echo "  Error: Make sure you source this script, not execute it. Eg:" 
     26     echo "    $ source gs3-setup.sh" 
     27     echo "  or" 
     28     echo "    $ . gs3-setup.sh" 
     29     echo "  not" 
     30     echo "    $ ./gs3-setup.sh" 
    3131     unset gsdl_not_sourced 
    3232     exit 1 
     
    4242function setGS3ENV() { 
    4343 
    44     echo "Setting up your environment for Greenstone3" 
    45     ## main greenstone environment variables ## 
    46     GSDL3SRCHOME=`pwd` 
    47     GSDL3HOME=$GSDL3SRCHOME/web 
    48     export GSDL3HOME 
    49     export GSDL3SRCHOME 
     44  echo "Setting up your environment for Greenstone3" 
     45  ## main greenstone environment variables ## 
     46  GSDL3SRCHOME=`pwd` 
     47  GSDL3HOME=$GSDL3SRCHOME/web 
     48  export GSDL3HOME 
     49  export GSDL3SRCHOME 
    5050 
    51     GSDLOS=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 
    52     # check for running bash under cygwin 
    53     if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ; then 
    54         GSDLOS=windows 
    55     fi  
    56     export GSDLOS 
    57     echo "  - Exported GSDL3HOME, GSDL3SRCHOME and GSDLOS" 
     51  GSDLOS=`uname -s | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` 
     52  # check for running bash under cygwin 
     53  if test "`echo $GSDLOS | sed 's/cygwin//'`" != "$GSDLOS" ; then 
     54    GSDLOS=windows 
     55  fi  
     56  export GSDLOS 
     57  echo "  - Exported GSDL3HOME, GSDL3SRCHOME and GSDLOS" 
    5858 
    59     #change this if external tomcat 
    60     TOMCAT_HOME=$GSDL3SRCHOME/packages/tomcat 
     59  #change this if external tomcat 
     60  TOMCAT_HOME=$GSDL3SRCHOME/packages/tomcat 
    6161 
    6262 
    63     ## adjustments to users (existing) environment ## 
     63  ## adjustments to users (existing) environment ## 
    6464 
    65     #PATH 
    66     if [ `isinpath "$PATH" "$GSDL3SRCHOME/bin"` == "false" ]; then 
    67         PATH=$GSDL3SRCHOME/bin/script:$GSDL3SRCHOME/bin:$PATH 
    68         export PATH 
    69         MANPATH=$MANPATH:$GSDL3SRCHOME/doc/man 
    70         export MANPATH 
    71         echo "  - Adjusted PATH" 
    72     else 
    73         echo "  - PATH already correct" 
    74     fi 
     65  #PATH 
     66  if [ `isinpath "$PATH" "$GSDL3SRCHOME/bin"` == "false" ]; then 
     67    PATH=$GSDL3SRCHOME/bin/script:$GSDL3SRCHOME/bin:$PATH 
     68    export PATH 
     69    MANPATH=$MANPATH:$GSDL3SRCHOME/doc/man 
     70    export MANPATH 
     71    echo "  - Adjusted PATH" 
     72  else 
     73    echo "  - PATH already correct" 
     74  fi 
    7575 
    76     #CLASSPATH 
    77     if [ `isinpath "$CLASSPATH" "$GSDL3HOME/WEB-INF/classes"` == "false" ]; then 
    78         CLASSPATH=$GSDL3HOME/WEB-INF/classes:$GSDL3SRCHOME/resources/java:$CLASSPATH 
    79         for JARFILE in $GSDL3SRCHOME/*.jar; do 
    80             CLASSPATH=$CLASSPATH:$JARFILE 
    81         done 
    82         for JARFILE in $GSDL3SRCHOME/lib/jni/*.jar; do 
    83             CLASSPATH=$CLASSPATH:$JARFILE 
    84         done 
    85         for JARFILE in $GSDL3HOME/WEB-INF/lib/*.jar; do 
    86             CLASSPATH=$CLASSPATH:$JARFILE 
    87         done 
    88         for JARFILE in $TOMCAT_HOME/common/endorsed/*.jar; do 
    89             CLASSPATH=$CLASSPATH:$JARFILE 
    90         done     
    91         for JARFILE in $GSDL3SRCHOME/build/*.jar; do 
    92             CLASSPATH=$CLASSPATH:$JARFILE 
    93         done 
    94         export CLASSPATH 
    95         echo "  - Adjusted CLASSPATH" 
    96     else 
    97         echo "  - CLASSPATH already correct" 
    98     fi 
     76  #CLASSPATH 
     77  if [ `isinpath "$CLASSPATH" "$GSDL3HOME/WEB-INF/classes"` == "false" ]; then 
     78    CLASSPATH=$GSDL3HOME/WEB-INF/classes:$GSDL3SRCHOME/resources/java:$CLASSPATH 
     79    for JARFILE in $GSDL3SRCHOME/*.jar; do 
     80      CLASSPATH=$CLASSPATH:$JARFILE 
     81    done 
     82    for JARFILE in $GSDL3SRCHOME/lib/jni/*.jar; do 
     83      CLASSPATH=$CLASSPATH:$JARFILE 
     84    done 
     85    for JARFILE in $GSDL3HOME/WEB-INF/lib/*.jar; do 
     86      CLASSPATH=$CLASSPATH:$JARFILE 
     87    done 
     88    for JARFILE in $TOMCAT_HOME/common/endorsed/*.jar; do 
     89      CLASSPATH=$CLASSPATH:$JARFILE 
     90    done     
     91    for JARFILE in $GSDL3SRCHOME/build/*.jar; do 
     92      CLASSPATH=$CLASSPATH:$JARFILE 
     93    done 
     94    export CLASSPATH 
     95    echo "  - Adjusted CLASSPATH" 
     96  else 
     97    echo "  - CLASSPATH already correct" 
     98  fi 
    9999 
    100     #LD_LIBRARY_PATH 
    101     if [ `isinpath "$LD_LIBRARY_PATH" "$GSDL3SRCHOME/lib/jni"` == "false" ]; then 
    102         LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GSDL3SRCHOME/lib/jni 
    103         export LD_LIBRARY_PATH 
    104         DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GSDL3SRCHOME/lib/jni 
    105         export DYLD_LIBRARY_PATH 
    106         echo "  - Adjusted LD_LIBRARY_PATH" 
    107     else 
    108         echo "  - LD_LIBRARY_PATH already correct" 
    109     fi 
     100  #LD_LIBRARY_PATH 
     101  if [ `isinpath "$LD_LIBRARY_PATH" "$GSDL3SRCHOME/lib/jni"` == "false" ]; then 
     102    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GSDL3SRCHOME/lib/jni 
     103    export LD_LIBRARY_PATH 
     104    DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GSDL3SRCHOME/lib/jni 
     105    export DYLD_LIBRARY_PATH 
     106    echo "  - Adjusted LD_LIBRARY_PATH" 
     107  else 
     108    echo "  - LD_LIBRARY_PATH already correct" 
     109  fi 
    110110 
    111     #ant 
    112     which ant &> /dev/null 
    113     if [ "$?" != "0" ]; then 
    114             ANT_HOME=$GSDL3SRCHOME/packages/ant 
    115             PATH=$ANT_HOME/bin:$PATH 
    116         echo "  - Setup ant" 
    117     else 
    118         echo "  - Ant already setup" 
    119     fi 
     111  #ant 
     112  which ant &> /dev/null 
     113  if [ "$?" != "0" ]; then 
     114      ANT_HOME=$GSDL3SRCHOME/packages/ant 
     115      PATH=$ANT_HOME/bin:$PATH 
     116    echo "  - Setup ant" 
     117  else 
     118    echo "  - Ant already setup" 
     119  fi 
    120120 
    121     echo 
     121  echo 
    122122} 
    123123 
    124124function checkJava() { 
    125     echo "Checking Java" 
     125  echo "Checking Java" 
    126126 
    127   bin/search4j -m $java_min_version &> /dev/null 
     127  HINT=`pwd`/packages/jre 
     128  bin/search4j -p $HINT -m $java_min_version &> /dev/null 
    128129  if [ "$?" != "0" ]; then 
    129130 
    130         #java is not set up already 
    131       bin/search4j -m $java_min_version -h packages/jre &> /dev/null 
    132       if [ "$?" == "0" ]; then 
    133             #bundled java exists, set up 
    134             export JAVA_HOME=`pwd`/packages/jre 
    135         echo "  - Exported JAVA_HOME to point to bundled java" 
    136         else 
    137             #no java exists 
    138         echo "  - Failed to locate java ($java_min_version or greater)" 
    139             bin/search4j &> /dev/null; if [ "$?" == "0" ]; then echo "  (It looks like you hava java but it's too old)"; fi 
    140             echo "  - Please set JAVA_HOME or JRE_HOME to point to an appropriate java" 
    141         echo "    And add JAVA_HOME/bin or JRE_HOME/bin to your PATH" 
    142         fi 
     131    #java is not set up already 
     132    FOUNDJAVAHOME=`bin/search4j -p $HINT -m $java_min_version` 
     133    if [ "$?" == "0" ]; then 
     134      #bundled java exists, set up 
     135      export JAVA_HOME=$FOUNDJAVAHOME 
     136      echo "  - Set (exported) JAVA_HOME to $FOUNDJAVAHOME" 
     137    else 
     138      #no java exists 
     139      echo "  - Failed to locate java ($java_min_version or greater)" 
     140      bin/search4j &> /dev/null; if [ "$?" == "0" ]; then echo "  (It looks like you hava java but it's too old)"; fi 
     141      echo "  - Please set JAVA_HOME or JRE_HOME to point to an appropriate java" 
     142      echo "    And add JAVA_HOME/bin or JRE_HOME/bin to your PATH" 
     143    fi 
    143144 
    144     else 
     145  else 
    145146 
    146         #java is already set up 
    147         echo "  - Found java at: `bin/search4j -m $java_min_version`" 
     147    #java is already set up 
     148    echo "  - Found java at: `bin/search4j -m $java_min_version`" 
    148149 
    149150  fi 
    150     echo 
     151  echo 
    151152} 
    152153 
     
    157158 
    158159function isinpath() { 
    159     for file in `echo $1 | sed 's/:/ /g'`; do 
    160         if [ "$file" == "$2" ]; then 
    161             echo true 
    162             return 
    163         fi 
    164     done 
    165     echo false 
     160  for file in `echo $1 | sed 's/:/ /g'`; do 
     161    if [ "$file" == "$2" ]; then 
     162      echo true 
     163      return 
     164    fi 
     165  done 
     166  echo false 
    166167} 
    167168