source: josm/trunk/linux/latest/usr/bin/josm-latest @ 10430

Last change on this file since 10430 was 10430, checked in by bastiK, 4 years ago

applied #13002 - Use /etc/default/josm to configure Java options (patch by sebastic)

  • Property svn:executable set to *
File size: 1.9 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
23if [ -f /etc/default/josm-latest ]; then
24    . /etc/default/josm-latest
25fi
26
27JAVA_OPTS="-Djosm.restart=true -Djosm.home=$HOME/.josm-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"
28
29if [ -z "${JAVACMD}" ]; then
30    for jcmd in $JAVA_CMDS; do
31        if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
32            JAVACMD="$jcmd"
33            break
34        fi
35    done
36fi
37
38if [ "$JAVACMD" ]; then
39    echo "Using $JAVACMD to execute josm-latest." || true
40    set +e
41    while true; do
42        $JAVACMD $JAVA_OPTS -jar /usr/share/josm-latest/josm-latest.jar "$@"
43        if [ "z$?" != "z9" ]; then
44            break
45        fi
46        echo ">> restarting josm..."
47    done
48else
49    echo "No valid JVM found to run JOSM." || true
50    exit 1
51fi
Note: See TracBrowser for help on using the repository browser.