[7481] | 1 | #!/bin/sh
|
---|
| 2 | # Simple wrapper script used to start JOSM in Debian
|
---|
| 3 | set -e
|
---|
| 4 |
|
---|
[9066] | 5 | # First, users preference as defined by $JAVA_HOME. Next, use OpenJDK or Oracle's proprietary JDK.
|
---|
[7481] | 6 | # Override to a specific one using $JAVACMD
|
---|
| 7 | # Let's get the current architecture -- needed for multiarchified Java
|
---|
| 8 | ARCH="`dpkg --print-architecture 2> /dev/null || true`"
|
---|
| 9 |
|
---|
| 10 | # If OpenJDK is only available headless, do not try it
|
---|
| 11 | if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
|
---|
[8970] | 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"
|
---|
[7481] | 16 | else
|
---|
[8970] | 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"
|
---|
[7481] | 21 | fi
|
---|
| 22 |
|
---|
| 23 | JAVA_OPTS="-Djosm.restart=true -Djosm.home=$HOME/.josm-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"
|
---|
| 24 |
|
---|
[8970] | 25 | if [ -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
|
---|
| 32 | fi
|
---|
[7481] | 33 |
|
---|
| 34 | if [ "$JAVACMD" ]; then
|
---|
| 35 | echo "Using $JAVACMD to execute josm-latest." || true
|
---|
| 36 | set +e
|
---|
| 37 | while true; do
|
---|
| 38 | $JAVACMD $JAVA_OPTS -jar /usr/share/josm-latest/josm-latest.jar "$@"
|
---|
| 39 | if [ "z$?" != "z9" ]; then
|
---|
| 40 | break
|
---|
| 41 | fi
|
---|
| 42 | echo ">> restarting josm..."
|
---|
| 43 | done
|
---|
| 44 | else
|
---|
| 45 | echo "No valid JVM found to run JOSM." || true
|
---|
| 46 | exit 1
|
---|
| 47 | fi
|
---|