source: josm/trunk/linux/tested/usr/bin/josm @ 9066

Last change on this file since 9066 was 9066, checked in by Don-vip, 5 years ago

see #11390 - drop support for ALTERNATIVE_JDK in Debian startup scripts

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/bin/sh
2# Simple wrapper script used to start JOSM in Debian
3set -e
4
5# First, users preference as defined by $JAVA_HOME. Next, use OpenJDK or Oracle's proprietary JDK.
6# Override to a specific one using $JAVACMD
7# Let's get the current architecture -- needed for multiarchified Java
8ARCH="`dpkg --print-architecture 2> /dev/null || true`"
9
10# If OpenJDK is only available headless, do not try it
11if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
12        JAVA_CMDS="$JAVA_HOME/bin/java"
13        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"
14        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"
15        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"
16else
17        JAVA_CMDS="$JAVA_HOME/bin/java /usr/bin/java"
18        JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-8-oracle/bin/java"
19        JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-7-oracle/bin/java"
20        JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-9-oracle/bin/java"
21fi
22
23JAVA_OPTS="-Djosm.restart=true -Djava.net.useSystemProxies=true $JAVA_OPTS"
24
25if [ -z "${JAVACMD}" ]; then
26    for jcmd in $JAVA_CMDS; do
27        if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
28            JAVACMD="$jcmd"
29            break
30        fi
31    done
32fi
33
34if [ "$JAVACMD" ]; then
35    echo "Using $JAVACMD to execute josm." || true
36    set +e
37    while true; do
38        $JAVACMD $JAVA_OPTS -jar /usr/share/josm/josm.jar "$@"
39        if [ "z$?" != "z9" ]; then
40            break
41        fi
42        echo ">> restarting josm..."
43    done
44else
45    echo "No valid JVM found to run JOSM." || true
46    exit 1
47fi
Note: See TracBrowser for help on using the repository browser.