From cc3d3021981a799c8c9d28dad4ad9bffa320a370 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 9 Jul 2017 10:49:57 +1200 Subject: Modify installation scripts --- setup/java-test/README.txt | 4 ++++ setup/java-test/Test.java | 5 +++++ setup/java-test/test.jar | Bin 0 -> 846 bytes setup/package.sh | 1 + setup/setup.sh | 6 +++--- 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 setup/java-test/README.txt create mode 100644 setup/java-test/Test.java create mode 100644 setup/java-test/test.jar diff --git a/setup/java-test/README.txt b/setup/java-test/README.txt new file mode 100644 index 000000000..b8ca72a7a --- /dev/null +++ b/setup/java-test/README.txt @@ -0,0 +1,4 @@ +Create Java version test: + +javac -target 6 -source 6 Test.java +jar cfe test.jar Test Test.class diff --git a/setup/java-test/Test.java b/setup/java-test/Test.java new file mode 100644 index 000000000..363d6953e --- /dev/null +++ b/setup/java-test/Test.java @@ -0,0 +1,5 @@ +public class Test { + public static void main(String[] a) { + System.exit(Integer.parseInt(System.getProperty("java.version").split("\\.")[1]) >= 7 ? 0 : 1); + } +} diff --git a/setup/java-test/test.jar b/setup/java-test/test.jar new file mode 100644 index 000000000..9bb41b3a0 Binary files /dev/null and b/setup/java-test/test.jar differ diff --git a/setup/package.sh b/setup/package.sh index 1070dbeba..b38371dda 100755 --- a/setup/package.sh +++ b/setup/package.sh @@ -118,6 +118,7 @@ package_unix () { find out -type f \( -name \*.sh -o -name \*.vm \) -print0 | xargs -0 dos2unix copy_files + cp java-test/test.jar out cp setup.sh out makeself --notemp out traccar.run "traccar" ./setup.sh diff --git a/setup/setup.sh b/setup/setup.sh index 43e183eea..2b0ad1e7e 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -2,16 +2,16 @@ if which java &>/dev/null then - if [ $(java -version 2>&1 | grep -i version | sed 's/.*version \"\(.*\)\.\(.*\)\..*\"/\1\2/; 1q') -lt 17 ] + if java -jar test.jar then - echo 'Java 7 or higher required' - else mkdir -p /opt/traccar cp -r * /opt/traccar rm -r ../out rm /opt/traccar/setup.sh chmod -r go+rX /opt/traccar /opt/traccar/bin/installDaemon.sh + else + echo 'Java 7 or higher is required' fi else echo 'Java runtime is required' -- cgit v1.2.3