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

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

see #15560, see #16047 - detect java 10/11 packages

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/bin/sh
2# Simple wrapper script used to start JOSM in Debian
3set -e
4
5# First, the alternative (if known to work) or users preference as defined by $JAVA_HOME. Next, use OpenJDK or Oracle's proprietary JDK.
6# Override to a specific one using $JAVACMD
7ALTERNATIVE_JDK="`readlink -n -f /etc/alternatives/java`"
8
9# Let's get the current architecture -- needed for multiarchified Java
10ARCH="`dpkg --print-architecture 2> /dev/null || true`"
11
12# If OpenJDK is only available headless, do not try it
13if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
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-10-openjdk/bin/java /usr/lib/jvm/java-10-openjdk-$ARCH/bin/java /usr/lib/jvm/java-10-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"
18 JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-11-openjdk/bin/java /usr/lib/jvm/java-11-openjdk-$ARCH/bin/java /usr/lib/jvm/java-11-oracle/bin/java"
19else
20 JAVA_CMDS="$JAVA_HOME/bin/java /usr/bin/java"
21 JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-8-oracle/bin/java"
22 JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-10-oracle/bin/java"
23 JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-9-oracle/bin/java"
24 JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-11-oracle/bin/java"
25fi
26
27if [ -f /etc/default/josm-latest ]; then
28 . /etc/default/josm-latest
29fi
30
31JAVA_OPTS="-Djosm.restart=true -Djosm.dir.name=JOSM-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"
32
33if [ -z "${JAVACMD}" ]; then
34 for jcmd in $JAVA_CMDS; do
35 if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
36 JAVACMD="$jcmd"
37 break
38 fi
39 done
40fi
41
42if [ -z "${JAVACMD}" ]; then
43 for jcmd in $JAVA_CMDS; do
44 if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
45 JAVACMD="$jcmd"
46 break
47 fi
48 done
49fi
50
51if [ "$JAVACMD" ]; then
52 echo "Using $JAVACMD to execute josm-latest." || true
53 if [ "`expr match \"${JAVACMD}\" 'java-9'`" != "0" ] || [ "`expr match \"${JAVACMD}\" 'java-10'`" != "0" ]; then
54 JAVA_OPTS="--add-modules java.activation,java.se.ee $JAVA_OPTS"
55 fi
56 set +e
57 while true; do
58 $JAVACMD $JAVA_OPTS -jar /usr/share/josm-latest/josm-latest.jar "$@"
59 if [ "z$?" != "z9" ]; then
60 break
61 fi
62 echo ">> restarting josm..."
63 done
64else
65 echo "No valid JVM found to run JOSM." || true
66 exit 1
67fi
Note: See TracBrowser for help on using the repository browser.