File: josm.sh

package info (click to toggle)
josm 0.0.svn7643+dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 67,480 kB
  • ctags: 25,960
  • sloc: java: 177,482; xml: 8,896; perl: 1,570; sh: 102; makefile: 81
file content (39 lines) | stat: -rw-r--r-- 1,190 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
# Simple wrapper script used to start JOSM in Debian
set -e

# First, the alternative (if known to work) or users preference as defined by $JAVA_HOME. Next, use OpenJDK or Sun's proprietary JDK.
# Override to a specific one using $JAVACMD
ALTERNATIVE_JDK="`readlink -n -f /etc/alternatives/java`"

# Let's get the current architecture -- needed for multiarchified Java
ARCH="`dpkg --print-architecture`"

# If OpenJDK is only available headless, do not try it
if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
	JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java"
else
	JAVA_CMDS="$JAVA_HOME/bin/java"
fi

JAVA_OPTS="$JAVA_OPTS -Djava.net.useSystemProxies=true"

for jcmd in $JAVA_CMDS; do
	if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
        JAVACMD="$jcmd"
    fi
done

for jcmd in $JAVA_CMDS; do
    if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
        JAVACMD="$jcmd"
    fi
done

if [ "$JAVACMD" ]; then
    echo "Using $JAVACMD to execute josm." || true
    exec $JAVACMD $JAVA_OPTS -jar /usr/share/josm/josm.jar "$@"
else
    echo "No valid JVM found to run JOSM." || true
    exit 1
fi