-
Notifications
You must be signed in to change notification settings - Fork 20
/
Arranger.sh
59 lines (52 loc) · 2.17 KB
/
Arranger.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
set -e
################################################################################
#
# Author: Bob Fisch
#
# Description: start script for Arranger
#
################################################################################
#
# Revision List
#
# Author Date Description
# ------ ---- -----------
# Bob Fisch 20??-??-?? First Issue
# Bob Fisch 2017-??-?? Check for Java > 8
# Rolf Schmidt 2018-06-03 fixed version check for OpenJDK 10+, Java 8
# Simon Sobisch 2018-06-03 Check for jar, tweaked version checks
# Bob Fisch 2018-09-05 get correct dir if symlinked
# Kay Gürtzig 2018-09-19 Bugfix #604: Condition in jar test (line 31) corrected (#586)
# Kay Gürtzig 2018-11-27 Precaution against installation path with blanks
# Kay Gürtzig 2021-06-13 Issue #944: Now requires Java 11 at least
#
################################################################################
# get dir of symbolic link
DIR="$(dirname "$(readlink -f "$0")")"
# check if JAVA binary is found
java 2>/dev/null 1>&2 || (rc=$? && if test $rc -gt 1; then (echo 'JAVA not found in $PATH' && exit $rc); fi)
# check for jar in PATH
if [ ! -f "$DIR/Structorizer.app/Contents/Java/Structorizer.jar" ]
then
echo "Error: $DIR/Structorizer.app/Contents/Java/Structorizer.jar not found."
exit
fi
# check for correct Java version
REQVERSION=11
JAVAVER=$(java -version 2>&1)
# Try new version scheme VER.MINOR.PATCHLEVEL first
VERSION=$(echo $JAVAVER | head -1 | cut -d. -f 1 | cut -d'"' -f 2)
if [ $VERSION -eq 1 ]
then
# Fallback for old 1.VER.BUILD
VERSION=$(echo $JAVAVER | head -1 | cut -d. -f 2 )
fi
if [ $VERSION -lt $REQVERSION ]
then
echo "Your Java version is $VERSION, but version $REQVERSION is required. Please update."
exit 1
fi
# actual start
#echo "Your Java version is $VERSION, all fine."
java -cp "$DIR/Structorizer.app/Contents/Java/Structorizer.jar" lu.fisch.structorizer.arranger.Arranger