Changeset 33931


Ignore:
Timestamp:
2020-02-15T19:10:54+13:00 (4 years ago)
Author:
davidb
Message:

Two changes to setup file. The first was to move the test for ant to be after running local/gs-setup.sh files as it could very well be the local/gs3-setup.sh file that adds in ant (when the test is earlier it can report that it has been unable to find it, which can be misleading). The second change relates to testing the bitness: 32-bit or 64-bit. Newer version of java (e.g. 1.11), no longer appear to support the -d flag related to bitness. The change still tries out a -d test, but if that fails the newer code added then uses 'file' to figure out the bitness of the binary and compare that with the compiled-up Greenstone bitness. For the ant change, it looks like how the Windows gs3-setup.bat does this and the message displayed isn't so confusing, so can probably stay as it is. For the bitness test, it would be good to update this to be the same as what has been done in this commit for the unix gs3-setup.sh file

File:
1 edited

Legend:

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

    r32488 r33931  
    122122  echo "  - Adjusted LD_LIBRARY_PATH and DYLD_LIBRARY_PATH"
    123123
    124   #ant
    125   ANT_VERSION=1.7.1
    126   if [ -x "$GSDL3SRCHOME/packages/ant/bin/ant" ]; then
    127     ANT_HOME="$GSDL3SRCHOME/packages/ant"
    128     export ANT_HOME
    129     addtopath PATH "$ANT_HOME/bin"
    130     echo "  - Setup Greenstone ant ($GSDL3SRCHOME/packages/ant)"
    131   else
    132     which ant &> /dev/null
    133     if [ "$?" == "0" ]; then
    134       echo "  - WARNING: Greenstone 'Ant' package missing - falling back to system Ant"
    135       echo "             Note that Greenstone requires Ant $ANT_VERSION or greater"
    136     elif [ "ANT_HOME" != "" ]; then
    137       addtopath PATH "$ANT_HOME/bin"
    138       echo "  - WARNING: Greenstone 'Ant' package missing - falling back to system Ant"
    139       echo "             Note that Greenstone requires Ant $ANT_VERSION or greater"
    140     else
    141       echo "  - ERROR: Greenstone 'Ant' package missing - please install Ant yourself"
    142       echo "           Note that Greenstone requires Ant $ANT_VERSION or greater"
    143     fi
    144   fi
    145 
    146124  #ImageMagick
    147125  #if test -d "$GSDL3SRCHOME/gs2build/bin/$GSDLOS/imagemagick" ; then
     
    309287    else
    310288      # search4j wasn't present, and no bundled JRE, so check JAVA_HOME or JRE_HOME manually
    311       echo "*** Could not find an appropriate JDK or JRE java"
    312       echo "*** Attempting to use JAVA_HOME else JRE_HOME in the environment"
    313 
     289      #echo "*** Could not find an appropriate JDK or JRE java"
     290      #echo "*** Attempting to use JAVA_HOME else JRE_HOME in the environment"
     291      echo "Checking for Java explicitly set through environment variables"
    314292      if [ "$JAVA_HOME" != "" ] && [ "`which java`" == "$JAVA_HOME/bin/java" ]; then
    315       echo "  - Using java at $JAVA_HOME"
    316       echo "  - WARNING: Greenstone has not checked the version number of this java installation"
    317       echo "             The source distribution of Greenstone3 requires java 1.5 or greater"
    318       echo "             (SVN users may still use java 1.4)"
     293      echo "  - Using Java at $JAVA_HOME"
     294      echo "  - Detected Java version: `$JAVA_HOME/bin/java -version 2>&1 | head -n 1`"
     295      echo "  - Note that Greenstone requires Java 1.5 or greater"
     296#     echo "  - WARNING: Greenstone has not checked the version number of this java installation"
     297#     echo "             The source distribution of Greenstone3 requires java 1.5 or greater"
     298#     echo "             (SVN users may still use java 1.4)"
    319299      elif [ "$JRE_HOME" != "" ] && [ "`which java`" == "$JRE_HOME/bin/java" ]; then
    320300      echo "  - Using java at $JRE_HOME"
    321       echo "  - WARNING: Greenstone has not checked the version number of this java installation"
    322       echo "             The source distribution of Greenstone3 requires java 1.5 or greater"
    323       echo "             (SVN users may still use java 1.4)"
     301      echo "  - Detected Java version: `$JAVA_HOME/bin/java -version 2>&1 | head -n 1`"
     302      echo "  - Note that Greenstone requires Java 1.5 or greater"   
     303#     echo "  - WARNING: Greenstone has not checked the version number of this java installation"
     304#     echo "             The source distribution of Greenstone3 requires java 1.5 or greater"
     305#     echo "             (SVN users may still use java 1.4)"
    324306     
    325307      #failing all that, print a warning
     
    374356
    375357    checkJavaBitnessAgainstGSBitness "$PATHTOJAVA" "$bitness"
    376    
     358    check_status=$?
     359
    377360    isjavaset=false
    378361
    379     if [ "$?" == "0" ]; then
     362    if [ "$check_status" == "0" ]; then
    380363    # http://tldp.org/LDP/abs/html/comparison-ops.html
    381364    if [ "$bitness" != "-1" ] && [ "$DEBUG" == "true" ]; then
     
    425408    return 0
    426409    elif [ "$?" == "1" ]; then
    427     return 1
     410
     411        # Newer Java's don't support -d, so result to using 'file' to determin bitness of 'java' binary
     412        java_bitness=`file $java_installation/bin/java`
     413        if [[ $java_bitness == *"$bitness-bit"* ]]; then
     414        return 0
     415    else
     416        return 1
     417    fi
    428418    else
    429419    echo "*** Problem determining bitness of java using java at $java_installation"
     
    528518checkJava
    529519echo ""
     520
     521#ant
     522ANT_VERSION=1.7.1
     523echo "Checking for Ant"
     524if [ -x "$GSDL3SRCHOME/packages/ant/bin/ant" ]; then
     525  ANT_HOME="$GSDL3SRCHOME/packages/ant"
     526  export ANT_HOME
     527  addtopath PATH "$ANT_HOME/bin"
     528  echo "  - Setup Greenstone ant ($GSDL3SRCHOME/packages/ant)"
     529else
     530  if [ "ANT_HOME" != "" ]; then
     531    addtopath PATH "$ANT_HOME/bin"
     532    echo "  - `ant -version`"
     533    echo "  - Note that Greenstone requires Ant $ANT_VERSION or greater"
     534  else
     535    which ant &> /dev/null
     536    if [ "$?" == "0" ]; then
     537      echo "  - System install ant detected"
     538      echo "  - `ant -version`"
     539      echo "  - Note that Greenstone requires Ant $ANT_VERSION or greater"
     540    else
     541      echo "  - WARNING: Failed to find 'ant'"
     542    fi
     543  fi
     544fi
     545
Note: See TracChangeset for help on using the changeset viewer.