Changeset 37672 for main


Ignore:
Timestamp:
2023-04-17T20:35:59+12:00 (12 months ago)
Author:
anupama
Message:

Making mac DMG's MacOS/greenstone script do what the linux wrapper.cpp script does in terms of handling command-line flags minus h/help or minus-minus help to display usage, minus extract and minux textonly, not just the default behaviour of trying to launch the graphical version of the Mac installer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/release-kits/shared/mac/Wrapper.app/Contents/MacOS/greenstone

    r31141 r37672  
    44cd "$BINDIR/.."
    55BASEDIR="`pwd`"
     6
     7displayUsage() {
     8    echo "Usage: $0 [OPTIONS]"
     9    echo "OPTIONS: "
     10    echo " -h, -help   Display this usage message"
     11    echo " -textonly   Do a non-graphical command line installation"
     12    echo " -extract    Extract the jar file, this can then be run manually (such as with custom Java options as arguments to the installer jar file)."
     13}
     14
     15# install_mode can be:
     16# Default behaviour (graphical installer, forced to textonly mode in non-graphical environment
     17# manual setting to Textonly mode
     18# Extract mode to extract jar file
     19install_mode="default"
     20
     21
     22if [ "x$1" != "x" ]; then
     23    if [ "$1" == "-h" ] || [ "$1" == "-help" ] || [ "$1" == "--help" ] ; then
     24    displayUsage
     25    exit 0
     26    elif [ "$1" == "-textonly" ] || [ "$1" == "-text" ] || [ "$1" == "text" ] ; then
     27    install_mode="textonly"
     28    elif [ "$1" == "-extract" ] || [ "$1" == "--extract" ] || [ "$1" == "-x" ] ; then
     29    install_mode="extract"
     30    else
     31    displayUsage
     32    exit 0
     33    fi
     34fi
     35
    636
    737# Debugging with a msg box. Need double quotes around msg for $var expansion
     
    2656        export JRE_HOME=/tmp/jre
    2757        export PATH=$JRE_HOME/bin:$PATH
    28         tar -xvf /tmp/jre.tar -C /tmp && rm /tmp/jre.tar && "/tmp/jre/bin/java" -jar -Xdock:icon="$BASEDIR/Resources/icon.icns" "$gs_installer"
     58        #tar -xvf /tmp/jre.tar -C /tmp && rm /tmp/jre.tar && "/tmp/jre/bin/java" -jar -Xdock:icon="$BASEDIR/Resources/icon.icns" "$gs_installer"
    2959
     60    tar -xvf /tmp/jre.tar -C /tmp && rm /tmp/jre.tar
     61
     62    if [ "$install_mode" = "extract" ] ; then
     63        # no need to extract: installer jar file already available in mac app
     64        echo ""
     65        echo "(Extracting jar file on mac is superfluous: the jar file is already ready for use at $gs_installer)"
     66        echo "You can now run '/tmp/jre/bin/java -jar \"$BASEDIR/Resources/Java/$gs_installer\" text'"
     67        echo "  to run the installer from the command line."
     68        echo "Once you're finished with the installer, you can run \"rm -rf /tmp/jre\" to get rid of the temporary Java Runtime."
     69        echo "Note: if the installer fails to run due to insufficient memory, try preceding the -jar with -Xmx300M in the above command."
     70        echo ""
     71    elif [ "$install_mode" = "textonly" ] ; then
     72        "/tmp/jre/bin/java" -Xmx300M -jar "$gs_installer" "text"
     73    else # "$install_mode" = "default", run the usual graphical GS3 mac installer
     74        # which already falls back to textonly mode if no graphical environment available
     75        "/tmp/jre/bin/java" -jar -Xdock:icon="$BASEDIR/Resources/icon.icns" "$gs_installer"
     76    fi
     77   
    3078        # if after running the installer, the user cancelled installation, then the jre would still be in tmp, remove it to
    31         if [[ -e "/tmp/jre" ]]; then
    32            rm -rf /tmp/jre
    33         fi
    34 
     79    if [ "$install_mode" != "extract" ] ; then
     80            if [[ -e "/tmp/jre" ]]; then
     81        rm -rf /tmp/jre
     82            fi
     83    fi
    3584     else
    3685       # Issues extracting the jre.tar into /tmp (maybe we couldn't even copy it there) - display error message
     
    4190else
    4291    # try using a system java to run the installer, as there is no bundled jre_bin for 32 bit Mac OS since these already came with java installed
    43  
     92  " -h, -help   Display this usage message"
     93
    4494    # get the GS jar installer's name and run it with a dock icon (http://stackoverflow.com/questions/6006173/how-do-you-change-the-dock-icon-of-a-java-program)
    4595    cd "$BASEDIR/Resources/Java/"
Note: See TracChangeset for help on using the changeset viewer.