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

Last change on this file since 11162 was 11162, checked in by bastiK, 8 years ago

fixed #6664 - use XDG Base Directory Specification on Linux

If existing ~/.josm directory is found, it will be used as before.
Otherwise, ~/.cache/JOSM, ~/.local/share/JOSM and
~/.config/JOSM are used for cache, user data and preferences.

New system property option -Djosm.dir.name=... to change this to
~/.cache/JOSM-latest, etc. for the josm-latest package.

  • Property svn:executable set to *
File size: 2.0 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-9-openjdk/bin/java /usr/lib/jvm/java-9-openjdk-$ARCH/bin/java /usr/lib/jvm/java-9-oracle/bin/java"
17else
18 JAVA_CMDS="$JAVA_HOME/bin/java /usr/bin/java"
19 JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-8-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.dir.name=JOSM-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"
28
29if [ -z "${JAVACMD}" ]; then
30 for jcmd in $JAVA_CMDS; do
31 if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
32 JAVACMD="$jcmd"
33 break
34 fi
35 done
36fi
37
38if [ -z "${JAVACMD}" ]; then
39 for jcmd in $JAVA_CMDS; do
40 if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
41 JAVACMD="$jcmd"
42 break
43 fi
44 done
45fi
46
47if [ "$JAVACMD" ]; then
48 echo "Using $JAVACMD to execute josm-latest." || true
49 set +e
50 while true; do
51 $JAVACMD $JAVA_OPTS -jar /usr/share/josm-latest/josm-latest.jar "$@"
52 if [ "z$?" != "z9" ]; then
53 break
54 fi
55 echo ">> restarting josm..."
56 done
57else
58 echo "No valid JVM found to run JOSM." || true
59 exit 1
60fi
Note: See TracBrowser for help on using the repository browser.