diff options
-rw-r--r-- | setup/java-test/README.txt | 4 | ||||
-rw-r--r-- | setup/java-test/Test.java | 10 | ||||
-rw-r--r-- | setup/java-test/test.jar | bin | 887 -> 0 bytes | |||
-rw-r--r-- | setup/other/traccar.sh | 48 | ||||
-rwxr-xr-x | setup/package.sh | 96 | ||||
-rwxr-xr-x | setup/setup.sh | 30 | ||||
-rw-r--r-- | setup/traccar.iss | 36 | ||||
-rw-r--r-- | setup/traccar.service (renamed from setup/other/traccar.service) | 2 |
8 files changed, 64 insertions, 162 deletions
diff --git a/setup/java-test/README.txt b/setup/java-test/README.txt deleted file mode 100644 index b8ca72a7a..000000000 --- a/setup/java-test/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -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 deleted file mode 100644 index 7d1b3972d..000000000 --- a/setup/java-test/Test.java +++ /dev/null @@ -1,10 +0,0 @@ -public class Test { - public static void main(String[] a) { - String[] versions = System.getProperty("java.version").split("\\."); - int major = Integer.parseInt(versions[0]); - if (major == 1) { - major = Integer.parseInt(versions[1]); - } - System.exit(major >= 7 ? 0 : 1); - } -} diff --git a/setup/java-test/test.jar b/setup/java-test/test.jar Binary files differdeleted file mode 100644 index f0484f274..000000000 --- a/setup/java-test/test.jar +++ /dev/null diff --git a/setup/other/traccar.sh b/setup/other/traccar.sh deleted file mode 100644 index fdf1b78e4..000000000 --- a/setup/other/traccar.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -#service traccar server for universal version -#e.g. ./traccar.sh start -#e.g. ./traccar.sh stop -#e.g. ./traccar.sh restart - -SERVICE_NAME=traccar -PATH_TO_JAR=tracker-server.jar -PATH_TO_CONF=conf/traccar.xml -PID_PATH_NAME=/tmp/traccar-pid -case $1 in - start) - echo "Starting $SERVICE_NAME ..." - if [ ! -f $PID_PATH_NAME ]; then - nohup java -jar $PATH_TO_JAR $PATH_TO_CONF /tmp 2>> /dev/null >> /dev/null & - echo $! > $PID_PATH_NAME - echo "$SERVICE_NAME started ..." - else - echo "$SERVICE_NAME is already running ..." - fi - ;; - stop) - if [ -f $PID_PATH_NAME ]; then - PID=$(cat $PID_PATH_NAME); - echo "$SERVICE_NAME stoping ..." - kill $PID; - echo "$SERVICE_NAME stopped ..." - rm $PID_PATH_NAME - else - echo "$SERVICE_NAME is not running ..." - fi - ;; - restart) - if [ -f $PID_PATH_NAME ]; then - PID=$(cat $PID_PATH_NAME); - echo "$SERVICE_NAME stopping ..."; - kill $PID; - echo "$SERVICE_NAME stopped ..."; - rm $PID_PATH_NAME - echo "$SERVICE_NAME starting ..." - nohup java -jar $PATH_TO_JAR $PATH_TO_CONF /tmp 2>> /dev/null >> /dev/null & - echo $! > $PID_PATH_NAME - echo "$SERVICE_NAME started ..." - else - echo "$SERVICE_NAME is not running ..." - fi - ;; -esac diff --git a/setup/package.sh b/setup/package.sh index ed897c201..9441e91e8 100755 --- a/setup/package.sh +++ b/setup/package.sh @@ -22,27 +22,23 @@ check_requirement () { fi } -check_requirement "ls ../../ext-6.2.0" "Missing ../../ext-6.2.0 (https://www.sencha.com/legal/GPL/)" -check_requirement "ls innosetup-*.exe" "Missing isetup-*.exe (http://www.jrsoftware.org/isdl.php)" +check_requirement "ls ../../ext-6.2.0" "Missing ExtJS (https://www.sencha.com/legal/GPL/)" +check_requirement "ls innosetup-*.exe" "Missing Inno Setup (http://www.jrsoftware.org/isdl.php)" +check_requirement "ls java-*.windows.x86_64.zip" "Missing Windows 64 Java (https://github.com/ojdkbuild/ojdkbuild)" +check_requirement "ls jdk-*-linux-x64.zip" "Missing Linux 64 Java (https://github.com/ojdkbuild/contrib_jdk10u-ci/releases)" +check_requirement "ls jdk-*-linux-armhf.zip" "Missing Linux ARM Java (https://github.com/ojdkbuild/contrib_jdk10u-aarch32-ci/releases)" check_requirement "which sencha" "Missing sencha cmd package (https://www.sencha.com/products/extjs/cmd-download/)" -check_requirement "which wine" "Missing wine package" -check_requirement "which innoextract" "Missing innoextract package" -check_requirement "which makeself" "Missing makeself package" +check_requirement "which unzip" "Missing unzip" +check_requirement "which wine" "Missing wine" +check_requirement "which innoextract" "Missing innoextract" +check_requirement "which makeself" "Missing makeself" +check_requirement "which jlink" "Missing jlink" prepare () { ../traccar-web/tools/minify.sh - innoextract innosetup-*.exe - echo "If you got any errors here try isetup version 5.5.5 (or check supported versions using 'innoextract -v')" -} - -cleanup () { - rm ../traccar-web/web/app.min.js - - rm -r app/ -} + mkdir -p out/{conf,data,lib,logs,web,schema,templates} -copy_files () { cp ../target/tracker-server.jar out cp ../target/lib/* out/lib cp ../schema/* out/schema @@ -50,55 +46,65 @@ copy_files () { cp -r ../traccar-web/web/* out/web cp default.xml out/conf cp traccar.xml out/conf -} -package_windows () { - mkdir -p out/{conf,data,lib,logs,web,schema,templates} + innoextract innosetup-*.exe + echo "If you got any errors here try isetup version 5.5.5 (or check supported versions using 'innoextract -v')" +} - copy_files +cleanup () { + rm ../traccar-web/web/app.min.js - wine app/ISCC.exe traccar.iss + rm -r out + rm -r tmp + rm -r app +} - zip -j traccar-windows-$VERSION.zip Output/traccar-setup.exe README.txt +package_other () { + cp README.txt out + cd out + zip -r ../traccar-other-$VERSION.zip * + cd .. + rm out/README.txt +} +package_windows () { + unzip -o java-*.windows.x86_64.zip + jlink --module-path java-*.windows.x86_64/jmods --add-modules java.se.ee --output out/jre + rm -rf java-*.windows.x86_64 + wine app/ISCC.exe traccar.iss + rm -rf out/jre + zip -j traccar-windows-64-$VERSION.zip Output/traccar-setup.exe README.txt rm -r Output - rm -r tmp - rm -r out } package_unix () { - mkdir -p out/{conf,data,lib,logs,web,schema,templates} - copy_files - - cp java-test/test.jar out cp setup.sh out - cp other/traccar.service out - makeself --notemp out traccar.run "traccar" ./setup.sh - - zip -j traccar-linux-$VERSION.zip traccar.run README.txt + cp traccar.service out + unzip -o jdk-*-linux-x64.zip + jlink --module-path jdk-*-linux-x64/jmods --add-modules java.se.ee --output out/jre + rm -rf jdk-*-linux-x64 + makeself --notemp out traccar.run "traccar" ./setup.sh + rm -rf out/jre + zip -j traccar-linux-64-$VERSION.zip traccar.run README.txt rm traccar.run - rm -r out -} - -package_universal () { - mkdir -p out/{conf,data,lib,logs,web,schema,templates} - - copy_files - - cp README.txt out - cd out - zip -r ../traccar-other-$VERSION.zip * - cd .. + unzip -o jdk-*-linux-armhf.zip + jlink --module-path jdk-*-linux-armhf/jmods --add-modules java.se.ee --output out/jre + rm -rf jdk-*-linux-armhf + makeself --notemp out traccar.run "traccar" ./setup.sh + rm -rf out/jre + zip -j traccar-linux-arm-$VERSION.zip traccar.run README.txt + rm traccar.run - rm -rf out/ + rm out/setup.sh + rm out/traccar.service } prepare +package_other package_windows package_unix -package_universal cleanup diff --git a/setup/setup.sh b/setup/setup.sh index b27fcbe1c..72fab94e9 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -1,24 +1,14 @@ #!/bin/sh -if which java &>/dev/null -then - if java -jar test.jar - then - mkdir -p /opt/traccar - cp -r * /opt/traccar - rm -r ../out - rm /opt/traccar/setup.sh - chmod -R go+rX /opt/traccar +mkdir -p /opt/traccar +cp -r * /opt/traccar +rm -r ../out +rm /opt/traccar/setup.sh +chmod -R go+rX /opt/traccar - mv /opt/traccar/traccar.service /etc/systemd/system - chmod 664 /etc/systemd/system/traccar.service +mv /opt/traccar/traccar.service /etc/systemd/system +chmod 664 /etc/systemd/system/traccar.service - systemctl daemon-reload - systemctl enable traccar.service - systemctl start traccar.service - else - echo 'Java 7 or higher is required' - fi -else - echo 'Java runtime is required' -fi +systemctl daemon-reload +systemctl enable traccar.service +systemctl start traccar.service diff --git a/setup/traccar.iss b/setup/traccar.iss index 4ad473053..4deccf2d9 100644 --- a/setup/traccar.iss +++ b/setup/traccar.iss @@ -2,50 +2,18 @@ AppName=Traccar AppVersion=4.0 DefaultDirName={pf}\Traccar -AlwaysRestart=yes OutputBaseFilename=traccar-setup ArchitecturesInstallIn64BitMode=x64 [Dirs] -Name: "{app}\conf" Name: "{app}\data" -Name: "{app}\lib" Name: "{app}\logs" -Name: "{app}\web" -Name: "{app}\schema" -Name: "{app}\templates" [Files] Source: "out\*"; DestDir: "{app}"; Flags: recursesubdirs [Run] -Filename: "java.exe"; Parameters: "-jar ""{app}\tracker-server.jar"" --install .\conf\traccar.xml"; Flags: runhidden +Filename: "{app}\jre\bin\java.exe"; Parameters: "-jar ""{app}\tracker-server.jar"" --install .\conf\traccar.xml"; Flags: runhidden [UninstallRun] -Filename: "java.exe"; Parameters: "-jar ""{app}\tracker-server.jar"" --uninstall"; Flags: runhidden - -[Code] -function GetLocalMachine(): Integer; -begin - if IsWin64 then - begin - Result := HKLM64; - end - else - begin - Result := HKEY_LOCAL_MACHINE; - end; -end; - -function InitializeSetup(): Boolean; -begin - if RegKeyExists(GetLocalMachine(), 'SOFTWARE\JavaSoft') then - begin - Result := true; - end - else - begin - Result := false; - MsgBox('This application requires Java Runtime Environment version 7 or later. Please download and install the JRE and run this setup again. If you have Java installed and still get this error, you need to re-install it from offline installer (for more info see https://www.traccar.org/windows/).', mbCriticalError, MB_OK); - end; -end; +Filename: "{app}\jre\bin\java.exe"; Parameters: "-jar ""{app}\tracker-server.jar"" --uninstall"; Flags: runhidden diff --git a/setup/other/traccar.service b/setup/traccar.service index 4b7404653..5bb4249f0 100644 --- a/setup/other/traccar.service +++ b/setup/traccar.service @@ -5,7 +5,7 @@ After=network.target [Service] Type=simple WorkingDirectory=/opt/traccar -ExecStart=/bin/sh -c "exec java -jar tracker-server.jar conf/traccar.xml" +ExecStart=/opt/traccar/jre/bin/java -jar tracker-server.jar conf/traccar.xml SyslogIdentifier=traccar [Install] |