Changeset 8970 in josm for trunk/linux/tested/usr


Ignore:
Timestamp:
2015-10-30T16:43:47+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #12033 - Linux: Simplify java alternatives testing in startup scripts (patch by sebastic)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/linux/tested/usr/bin/josm

    r8777 r8970  
    1212# If OpenJDK is only available headless, do not try it
    1313if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
    14         JAVA9_CMDS="/usr/lib/jvm/java-9-openjdk/bin/java /usr/lib/jvm/java-9-openjdk-$ARCH/bin/java /usr/lib/jvm/java-9-oracle/bin/java"
    15         JAVA8_CMDS="/usr/lib/jvm/java-8-openjdk/bin/java /usr/lib/jvm/java-8-openjdk-$ARCH/bin/java /usr/lib/jvm/java-8-oracle/bin/java"
    16         JAVA7_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-7-oracle/bin/java"
     14        JAVA_CMDS="$JAVA_HOME/bin/java"
     15        JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-8-openjdk/bin/java /usr/lib/jvm/java-8-openjdk-$ARCH/bin/java /usr/lib/jvm/java-8-oracle/bin/java"
     16        JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-7-oracle/bin/java"
     17        JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-9-openjdk/bin/java /usr/lib/jvm/java-9-openjdk-$ARCH/bin/java /usr/lib/jvm/java-9-oracle/bin/java"
    1718else
    18         JAVA9_CMDS="/usr/lib/jvm/java-9-oracle/bin/java"
    19         JAVA8_CMDS="/usr/lib/jvm/java-8-oracle/bin/java"
    20         JAVA7_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/bin/java"
     19        JAVA_CMDS="$JAVA_HOME/bin/java /usr/bin/java"
     20        JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-8-oracle/bin/java"
     21        JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-7-oracle/bin/java"
     22        JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-9-oracle/bin/java"
    2123fi
    2224
    2325JAVA_OPTS="-Djosm.restart=true -Djava.net.useSystemProxies=true $JAVA_OPTS"
    2426
    25 for jcmd in $JAVA8_CMDS; do
    26         if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
    27         JAVACMD="$jcmd"
    28     fi
    29 done
     27if [ -z "${JAVACMD}" ]; then
     28    for jcmd in $JAVA_CMDS; do
     29        if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
     30            JAVACMD="$jcmd"
     31            break
     32        fi
     33    done
     34fi
    3035
    31 for jcmd in $JAVA8_CMDS; do
    32     if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
    33         JAVACMD="$jcmd"
    34     fi
    35 done
    36 
    37 for jcmd in $JAVA7_CMDS; do
    38         if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
    39         JAVACMD="$jcmd"
    40     fi
    41 done
    42 
    43 for jcmd in $JAVA7_CMDS; do
    44     if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
    45         JAVACMD="$jcmd"
    46     fi
    47 done
    48 
    49 for jcmd in $JAVA9_CMDS; do
    50         if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
    51         JAVACMD="$jcmd"
    52     fi
    53 done
    54 
    55 for jcmd in $JAVA9_CMDS; do
    56     if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
    57         JAVACMD="$jcmd"
    58     fi
    59 done
     36if [ -z "${JAVACMD}" ]; then
     37    for jcmd in $JAVA_CMDS; do
     38        if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
     39            JAVACMD="$jcmd"
     40            break
     41        fi
     42    done
     43fi
    6044
    6145if [ "$JAVACMD" ]; then
Note: See TracChangeset for help on using the changeset viewer.