Changeset 20217 for greenstone3

Show
Ignore:
Timestamp:
11.08.2009 17:48:44 (11 years ago)
Author:
oranfry
Message:

made gs3-setup.sh work even without search4j compiled

Files:
1 modified

Legend:

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

    r20216 r20217  
    123123    which ant &> /dev/null 
    124124    if [ "$?" == "0" ]; then 
    125       echo "  - Greenstone 'Ant' package missing - falling back to system Ant" 
     125      echo "  - WARNING: Greenstone 'Ant' package missing - falling back to system Ant" 
     126      echo "             Note that Greenstone requires Ant 1.7.1 or greater" 
    126127    else 
    127128      echo "  - ERROR: Greenstone 'Ant' package missing - please install Ant yourself" 
    128     fi 
    129     echo "    (Greenstone requires Ant 1.7.1 or greater)" 
     129      echo "           Note that Greenstone requires Ant 1.7.1 or greater" 
     130    fi 
     131 
    130132  fi 
    131133 
     
    138140        HINT=/System/Library/Frameworks/JavaVM.framework/Home 
    139141  fi 
    140   FOUNDJAVAHOME="`bin/search4j -p \"$HINT\" -m $java_min_version`" 
    141   if [ "$?" == "0" ]; then 
    142       #bundled java exists, set up 
    143       export JAVA_HOME="$FOUNDJAVAHOME" 
    144       addtopath PATH "$JAVA_HOME/bin" 
    145       echo "  - Exported JAVA_HOME to $FOUNDJAVAHOME" 
     142 
     143  #if search4j is present, use it 
     144  if [ -x bin/search4j ] ; then 
     145    FOUNDJAVAHOME="`bin/search4j -p \"$HINT\" -m $java_min_version`" 
     146    if [ "$?" == "0" ]; then 
     147      #found a suitible java 
     148      setupJavaAt "$FOUNDJAVAHOME" 
     149    else 
     150      #no suitable java exists 
     151      echo "  - ERROR: Failed to locate java $java_min_version or greater" 
     152      echo "           Please set JAVA_HOME or JRE_HOME to point to an appropriate java" 
     153      echo "           And add JAVA_HOME/bin or JRE_HOME/bin to your PATH" 
     154    fi 
     155 
     156  #otherwise manually try the hint 
     157  elif [ -d "$HINT" ]; then 
     158      #found a suitible java 
     159      setupJavaAt "$HINT" 
     160 
     161  #lastly, check if java already setup 
     162  elif [ "$JAVA_HOME" != "" ] && [ "`which java`" == "$JAVA_HOME/bin/java" ]; then 
     163    echo "  - Using java at $JAVA_HOME" 
     164  elif [ "$JRE_HOME" != "" ] && [ "`which java`" == "$JRE_HOME/bin/java" ]; then 
     165    echo "  - Using java at $JRE_HOME" 
     166  #failing all that, print a warning 
    146167  else 
    147       #no suitable java exists 
    148       echo "  ERROR: Failed to locate java $java_min_version or greater" 
    149       bin/search4j &> /dev/null; 
    150       if [ "$?" == "0" ]; then echo "  It looks like you hava java but it's too old"; fi 
    151       echo "  Please set JAVA_HOME or JRE_HOME to point to an appropriate java" 
    152       echo "  And add JAVA_HOME/bin or JRE_HOME/bin to your PATH" 
    153   fi 
     168    #no suitable java exists 
     169    echo "  - ERROR: Failed to locate java" 
     170    echo "           Please set JAVA_HOME or JRE_HOME to point to an appropriate java" 
     171    echo "           And add JAVA_HOME/bin or JRE_HOME/bin to your PATH" 
     172  fi 
     173} 
     174 
     175function setupJavaAt() { 
     176  export JAVA_HOME="$1" 
     177  addtopath PATH "$JAVA_HOME/bin" 
     178  echo "  - Exported JAVA_HOME to $JAVA_HOME" 
    154179} 
    155180