diff options
Diffstat (limited to 'setup')
-rw-r--r-- | setup/default.xml | 100 | ||||
-rw-r--r-- | setup/docker/Dockerfile | 28 | ||||
-rwxr-xr-x | setup/docker/build.sh | 31 | ||||
-rw-r--r-- | setup/environment.sh | 26 | ||||
-rw-r--r-- | setup/java-test/README.txt | 4 | ||||
-rw-r--r-- | setup/java-test/Test.java | 5 | ||||
-rw-r--r-- | setup/java-test/test.jar | bin | 829 -> 0 bytes | |||
-rw-r--r-- | setup/other/traccar.sh | 48 | ||||
-rwxr-xr-x | setup/package.sh | 254 | ||||
-rwxr-xr-x | setup/setup.sh | 28 | ||||
-rw-r--r-- | setup/traccar.iss | 39 | ||||
-rw-r--r-- | setup/traccar.service | 13 |
12 files changed, 285 insertions, 291 deletions
diff --git a/setup/default.xml b/setup/default.xml index 8b8e0d623..1d82ad926 100644 --- a/setup/default.xml +++ b/setup/default.xml @@ -4,70 +4,78 @@ <properties> - <!-- SERVER CONFIG --> + <!-- + + DO NOT MODIFY THIS FILE. Use traccar.xml instead. + + --> <entry key='web.enable'>true</entry> <entry key='web.port'>8082</entry> <entry key='web.path'>./web</entry> <entry key='web.cacheControl'>max-age=3600,public</entry> - <entry key='geocoder.enable'>true</entry> + <entry key='geocoder.enable'>false</entry> <entry key='geocoder.type'>google</entry> <entry key='logger.enable'>true</entry> - <entry key='logger.level'>all</entry> + <entry key='logger.level'>info</entry> <entry key='logger.file'>./logs/tracker-server.log</entry> + <entry key='logger.rotate'>true</entry> + + <entry key='filter.enable'>true</entry> + <entry key='filter.future'>86400</entry> <entry key='event.enable'>true</entry> + <entry key='event.ignoreDuplicateAlerts'>true</entry> <entry key='processing.computedAttributes.enable'>true</entry> + <entry key='processing.engineHours.enable'>true</entry> <entry key='media.path'>./media</entry> + <entry key='notificator.types'>web,mail</entry> + <entry key='server.statistics'>https://www.traccar.org/analytics/</entry> - <!-- DATABASE CONFIG --> + <entry key='commands.queueing'>true</entry> <entry key='database.ignoreUnknown'>true</entry> - <entry key='database.generateQueries'>true</entry> - <entry key='database.changelog'>./schema/changelog-master.xml</entry> <entry key='database.loginUser'> - SELECT * FROM users - WHERE email = :email + SELECT * FROM tc_users + WHERE email = :email OR login = :email </entry> <entry key='database.selectPositions'> - SELECT * FROM positions WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to ORDER BY fixTime + SELECT * FROM tc_positions WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to ORDER BY fixTime </entry> <entry key='database.selectLatestPositions'> - SELECT positions.* FROM positions INNER JOIN devices ON positions.id = devices.positionid; + SELECT tc_positions.* FROM tc_positions INNER JOIN tc_devices ON tc_positions.id = tc_devices.positionid; </entry> <entry key='database.updateLatestPosition'> - UPDATE devices SET positionId = :id WHERE id = :deviceId + UPDATE tc_devices SET positionId = :id WHERE id = :deviceId </entry> <entry key='database.selectEvents'> - SELECT * FROM events WHERE deviceId = :deviceId AND serverTime BETWEEN :from AND :to ORDER BY serverTime + SELECT * FROM tc_events WHERE deviceId = :deviceId AND serverTime BETWEEN :from AND :to ORDER BY serverTime </entry> <entry key='database.deletePositions'> - DELETE FROM positions WHERE serverTime < :serverTime AND id NOT IN (SELECT positionId FROM devices WHERE positionId IS NOT NULL) + DELETE FROM tc_positions WHERE serverTime < :serverTime AND id NOT IN (SELECT positionId FROM tc_devices WHERE positionId IS NOT NULL) </entry> <entry key='database.deleteEvents'> - DELETE FROM events WHERE serverTime < :serverTime + DELETE FROM tc_events WHERE serverTime < :serverTime </entry> <entry key='database.selectStatistics'> - SELECT * FROM statistics WHERE captureTime BETWEEN :from AND :to ORDER BY captureTime + SELECT * FROM tc_statistics WHERE captureTime BETWEEN :from AND :to ORDER BY captureTime </entry> - <!-- PROTOCOL CONFIG --> - <entry key='gps103.port'>5001</entry> <entry key='tk103.port'>5002</entry> <entry key='gl100.port'>5003</entry> @@ -220,7 +228,61 @@ <entry key='flespi.port'>5149</entry> <entry key='dway.port'>5150</entry> <entry key='recoda.port'>5151</entry> - <entry key='arnavi4.port'>5152</entry> - + <entry key='oko.port'>5152</entry> + <entry key='ivt401.port'>5153</entry> + <entry key='sigfox.port'>5154</entry> + <entry key='t57.port'>5155</entry> + <entry key='spot.port'>5156</entry> + <entry key='m2c.port'>5157</entry> + <entry key='austinnb.port'>5158</entry> + <entry key='opengts.port'>5159</entry> + <entry key='cautela.port'>5160</entry> + <entry key='continental.port'>5161</entry> + <entry key='egts.port'>5162</entry> + <entry key='robotrack.port'>5163</entry> + <entry key='pt60.port'>5164</entry> + <entry key='telemax.port'>5165</entry> + <entry key='sabertek.port'>5166</entry> + <entry key='retranslator.port'>5167</entry> + <entry key='svias.port'>5168</entry> + <entry key='eseal.port'>5169</entry> + <entry key='freematics.port'>5170</entry> + <entry key='avema.port'>5171</entry> + <entry key='autotrack.port'>5172</entry> + <entry key='tek.port'>5173</entry> + <entry key='wristband.port'>5174</entry> + <entry key='applet.port'>5175</entry> + <entry key='milesmate.port'>5176</entry> + <entry key='anytrek.port'>5177</entry> + <entry key='smartsole.port'>5178</entry> + <entry key='its.port'>5179</entry> + <entry key='xrb28.port'>5180</entry> + <entry key='c2stek.port'>5181</entry> + <entry key='nyitech.port'>5182</entry> + <entry key='neos.port'>5183</entry> + <entry key='satsol.port'>5184</entry> + <entry key='globalstar.port'>5185</entry> + <entry key='sanul.port'>5186</entry> + <entry key='minifinder2.port'>5187</entry> + <entry key='radar.port'>5188</entry> + <entry key='techtlt.port'>5189</entry> + <entry key='starcom.port'>5190</entry> + <entry key='mictrack.port'>5191</entry> + <entry key='plugin.port'>5192</entry> + <entry key='leafspy.port'>5193</entry> + <entry key='naviset.port'>5194</entry> + <entry key='racedynamics.port'>5195</entry> + <entry key='rst.port'>5196</entry> + <entry key='pt215.port'>5197</entry> + <entry key='pacifictrack.port'>5198</entry> + <entry key='topin.port'>5199</entry> + <entry key='outsafe.port'>5200</entry> + <entry key='solarpowered.port'>5201</entry> + <entry key='motor.port'>5202</entry> + <entry key='omnicomm.port'>5203</entry> + <entry key='s168.port'>5204</entry> + <entry key='vnet.port'>5205</entry> + <entry key='blue.port'>5206</entry> + <entry key='pst.port'>5207</entry> </properties> diff --git a/setup/docker/Dockerfile b/setup/docker/Dockerfile deleted file mode 100644 index d86b078c1..000000000 --- a/setup/docker/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM java:8-alpine - -MAINTAINER Danilo Recchia <danilo.recchia@vortus.solutions> - -USER root - -RUN apk upgrade --update && \ - apk add --update curl bash && \ - rm -rf /var/cache/apk/* && \ - mkdir -p /opt/traccar/logs && \ - mkdir -p /opt/traccar/data - -ENV JAVA_OPTS -Xms256m -Xmx1024m - -COPY ./tmp/traccar.xml /opt/traccar/traccar.xml -COPY ./tmp/default.xml /opt/traccar/conf/default.xml -COPY ./tmp/schema /opt/traccar/schema -COPY ./tmp/templates /opt/traccar/templates -COPY ./tmp/web /opt/traccar/web -COPY ./tmp/lib /opt/traccar/lib -COPY ./tmp/traccar-server.jar /opt/traccar/traccar-server.jar - -EXPOSE 8082 -EXPOSE 5000-5150 - -WORKDIR /opt/traccar - -ENTRYPOINT ["java","-jar","traccar-server.jar","traccar.xml"] diff --git a/setup/docker/build.sh b/setup/docker/build.sh deleted file mode 100755 index b4cb75a4a..000000000 --- a/setup/docker/build.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -which mvn &> /dev/null || { echo >&2 "Maven package cant be found on path. Aborting."; exit 1; } -which awk &> /dev/null || { echo >&2 "Awk package cant be found on path. Aborting."; exit 1; } -which docker &> /dev/null || { echo >&2 "Docker package cant be found on path. Aborting."; exit 1; } -mvn package || { echo >&2 "Maven package has failed. Aborting."; exit 1; } - -export company=${1:-"tananaev"} -export software=${2:-"traccar"} -export _version=$(head -n 10 ./pom.xml |grep version|cut -d ">" -f2|cut -d"<" -f1) -export version=${3:-$_version} - -tmp="./setup/docker/tmp" - -mkdir -p ${tmp} - -cat ./setup/traccar.xml | awk '/config.default/ && !modif { print;printf(" <entry key=\"web.debug\">true</entry>\n");next; modif=1 } {print}' > ${tmp}/traccar.xml -cp -rf ./setup/default.xml ${tmp} -cp -rf ./schema ${tmp}/schema -cp -rf ./templates ${tmp}/templates -cp -rf ./target/tracker-server.jar ${tmp}/traccar-server.jar -cp -rf ./target/lib ${tmp}/lib -if [ -d ./traccar-web/web ]; then - cp -rf ./traccar-web/web ${tmp}/web -else - mkdir ${tmp}/web -fi - -docker build -t ${company}/${software}:${version} ./setup/docker/ - -rm -rf ${tmp} diff --git a/setup/environment.sh b/setup/environment.sh new file mode 100644 index 000000000..5090bbfb7 --- /dev/null +++ b/setup/environment.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +add-apt-repository ppa:openjdk-r/ppa +apt update +apt install openjdk-11-jdk zip unzip innoextract wine makeself + +# /usr/bin/printf '\xfe\xed\xfe\xed\x00\x00\x00\x02\x00\x00\x00\x00\xe2\x68\x6e\x45\xfb\x43\xdf\xa4\xd9\x92\xdd\x41\xce\xb6\xb2\x1c\x63\x30\xd7\x92' > /etc/ssl/certs/java/cacerts +# /var/lib/dpkg/info/ca-certificates-java.postinst configure + +git clone --recurse-submodules https://github.com/traccar/traccar.git +(cd traccar/traccar-web && git checkout master) +(cd traccar && ./gradlew assemble) + +wget http://cdn.sencha.com/ext/gpl/ext-6.2.0-gpl.zip +unzip ext-*-gpl.zip ; rm ext-*-gpl.zip + +wget http://cdn.sencha.com/cmd/7.1.0.15/no-jre/SenchaCmd-7.1.0.15-linux-i386.sh.zip +unzip SenchaCmd-*.zip ; rm SenchaCmd-*.zip +./SenchaCmd-*.sh -q ; rm SenchaCmd-* +export PATH=$PATH:~/bin/Sencha/Cmd/ + +cd traccar/setup +wget http://files.jrsoftware.org/is/5/isetup-5.5.8.exe +wget https://github.com/ojdkbuild/ojdkbuild/releases/download/java-11-openjdk-debug-11.0.6.10-1/java-11-openjdk-debug-11.0.6.10-1.windows.ojdkbuild.x86_64.zip +wget https://github.com/ojdkbuild/contrib_jdk11u-ci/releases/download/jdk-11.0.5%2B10/jdk-11.0.5-ojdkbuild-linux-x64.zip +wget https://github.com/ojdkbuild/contrib_jdk11u-arm32-ci/releases/download/jdk-11.0.5%2B10/jdk-11.0.5-ojdkbuild-linux-armhf.zip diff --git a/setup/java-test/README.txt b/setup/java-test/README.txt deleted file mode 100644 index 95dbfcc24..000000000 --- a/setup/java-test/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -Create Java version test: - -javac -target 5 -source 5 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 363d6953e..000000000 --- a/setup/java-test/Test.java +++ /dev/null @@ -1,5 +0,0 @@ -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 Binary files differdeleted file mode 100644 index 3afb7e312..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 b38371dda..7f23069c5 100755 --- a/setup/package.sh +++ b/setup/package.sh @@ -1,92 +1,96 @@ -#!/bin/bash +#!/usr/bin/env bash # -# Script to create installers +# Script to create installers for various platforms. # cd $(dirname $0) +usage () { + echo "Usage: $0 VERSION [PLATFORM]" + echo "Build Traccar installers." + echo + echo "Without PLATFORM provided, builds installers for all platforms." + echo + echo "Available platforms:" + echo " * linux-64" + echo " * linux-arm" + echo " * windows-64" + echo " * other" + exit 1 +} + if [[ $# -lt 1 ]] then - echo "USAGE: $0 <version>" - exit 1 + usage fi -VERSION=$1 - -check_requirement () { - if ! eval $1 &>/dev/null - then - echo $2 - exit 1 - fi +info () { + echo -e "[\033[1;34mINFO\033[0m] "$1 } -check_requirement "ls ../../ext-6.2.0" "Missing ../../ext-6.2.0 (https://www.sencha.com/legal/GPL/)" -check_requirement "ls yajsw-*.zip" "Missing yajsw-*.zip (https://sourceforge.net/projects/yajsw/files/)" -check_requirement "ls innosetup-*.exe" "Missing isetup-*.exe (http://www.jrsoftware.org/isdl.php)" -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 dos2unix" "Missing dos2unix package" - -prepare () { - unzip yajsw-*.zip - mv yajsw-*/ yajsw/ - - ../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')" +ok () { + echo -e "[\033[1;32m OK \033[0m] "$1 } -cleanup () { - rm -r yajsw/ - - rm ../traccar-web/web/app.min.js - - rm -r app/ +warn () { + echo -e "[\033[1;31mWARN\033[0m] "$1 } -copy_wrapper () { - cp yajsw/$1/setenv* out/$1 - cp yajsw/$1/wrapper* out/$1 - cp yajsw/$1/install* out/$1 - cp yajsw/$1/start* out/$1 - cp yajsw/$1/stop* out/$1 - cp yajsw/$1/uninstall* out/$1 - - chmod +x out/$1/* - - cp yajsw/conf/wrapper.conf.default out/conf - - touch out/conf/wrapper.conf - echo "wrapper.java.command=java" >> out/conf/wrapper.conf - echo "wrapper.java.app.jar=tracker-server.jar" >> out/conf/wrapper.conf - echo "wrapper.app.parameter.1=./conf/traccar.xml" >> out/conf/wrapper.conf - echo "wrapper.java.additional.1=-Dfile.encoding=UTF-8" >> out/conf/wrapper.conf - echo "wrapper.logfile=logs/wrapper.log.YYYYMMDD" >> out/conf/wrapper.conf - echo "wrapper.logfile.rollmode=DATE" >> out/conf/wrapper.conf - echo "wrapper.ntservice.name=traccar" >> out/conf/wrapper.conf - echo "wrapper.ntservice.displayname=Traccar" >> out/conf/wrapper.conf - echo "wrapper.ntservice.description=Traccar" >> out/conf/wrapper.conf - echo "wrapper.daemon.run_level_dir=\${if (new File('/etc/rc0.d').exists()) return '/etc/rcX.d' else return '/etc/init.d/rcX.d'}" >> out/conf/wrapper.conf - - cp -r yajsw/lib/* out/lib - find out/lib -type f -name ReadMe.txt -exec rm -f {} \; - - cp yajsw/templates/* out/templates - - cp yajsw/wrapper*.jar out +VERSION=$1 +PLATFORM=${2:-all} +export EXTJS_PATH=$(cd ../..; pwd)/ext-6.2.0 +PREREQ=true - if which xattr &>/dev/null +check_requirement () { + if ! eval $2 &>/dev/null then - xattr -dr com.apple.quarantine out + warn "$3" + PREREQ=false + else + ok "$@" fi } -copy_files () { +info "Checking build requirements for platform: "$PLATFORM +check_requirement "Traccar server archive" "ls ../target/tracker-server.jar" "Missing traccar archive" +check_requirement "Traccar web interface" "ls ../traccar-web/tools/minify.sh" "Missing traccar-web sources" +check_requirement "Zip" "which zip" "Missing zip binary" +check_requirement "Unzip" "which unzip" "Missing unzip binary" +check_requirement "Ext JS" "ls $EXTJS_PATH" "ExtJS not found in $EXTJS_PATH (https://www.sencha.com/legal/GPL/)" +check_requirement "Sencha Cmd" "which sencha" "Missing Sencha Cmd package (https://www.sencha.com/products/extjs/cmd-download/)" +if [ $PLATFORM != "other" ]; then + check_requirement "Jlink" "which jlink" "Missing jlink binary" +fi +if [ $PLATFORM = "all" -o $PLATFORM = "windows-64" ]; then + check_requirement "Inno Extractor" "which innoextract" "Missing innoextract binary" + check_requirement "Inno Setup" "ls i*setup-*.exe" "Missing Inno Setup (http://www.jrsoftware.org/isdl.php)" + check_requirement "Windows 64 Java" "ls java-*.windows.ojdkbuild.x86_64.zip" "Missing Windows 64 Java (https://github.com/ojdkbuild/ojdkbuild)" + check_requirement "Wine" "which wine" "Missing wine binary" +fi +if [ $PLATFORM = "all" -o $PLATFORM = "linux-64" -o $PLATFORM = "linux-arm" ]; then + check_requirement "Makeself" "which makeself" "Missing makeself binary" +fi +if [ $PLATFORM = "all" -o $PLATFORM = "linux-64" ]; then + check_requirement "Linux 64 Java" "ls jdk-*-linux-x64.zip" "Missing Linux 64 Java (https://github.com/ojdkbuild/contrib_jdk11u-ci/releases)" +fi +if [ $PLATFORM = "all" -o $PLATFORM = "linux-arm" ]; then + check_requirement "Linux ARM Java" "ls jdk-*-linux-armhf.zip" "Missing Linux ARM Java (https://github.com/ojdkbuild/contrib_jdk11u-aarch32-ci/releases)" +fi +if [ $PREREQ = false ]; then + info "Missing build requirements, aborting..." + exit 1 +else + info "Building..." +fi + +prepare () { + info "Generating app.min.js" + ../traccar-web/tools/minify.sh >/dev/null + ok "Created app.min.js" + + mkdir -p out/{conf,data,lib,logs,web,schema,templates} + cp ../target/tracker-server.jar out cp ../target/lib/* out/lib cp ../schema/* out/schema @@ -94,60 +98,102 @@ copy_files () { cp -r ../traccar-web/web/* out/web cp default.xml out/conf cp traccar.xml out/conf -} - -package_windows () { - mkdir -p out/{bat,conf,data,lib,logs,web,schema,templates} - copy_wrapper "bat" - copy_files - - wine app/ISCC.exe traccar.iss + if [ $PLATFORM = "all" -o $PLATFORM = "windows-64" ]; then + innoextract i*setup-*.exe >/dev/null + info "If you got any errors here try Inno Setup version 5.5.5 (or check supported versions using 'innoextract -v')" + fi +} - zip -j traccar-windows-$VERSION.zip Output/traccar-setup.exe README.txt +cleanup () { + info "Cleanup" + rm ../traccar-web/web/app.min.js - rm -r Output - rm -r tmp rm -r out + if [ $PLATFORM = "all" -o $PLATFORM = "windows-64" ]; then + rm -r tmp + rm -r app + fi } -package_unix () { - mkdir -p out/{bin,conf,data,lib,logs,web,schema,templates} +package_other () { + info "Building Zip archive" + cp README.txt out + cd out + zip -q -r ../traccar-other-$VERSION.zip * + cd .. + rm out/README.txt + ok "Created Zip archive" +} - copy_wrapper "bin" - find out -type f \( -name \*.sh -o -name \*.vm \) -print0 | xargs -0 dos2unix - copy_files +package_windows () { + info "Building Windows 64 installer" + unzip -q -o java-*.windows.ojdkbuild.x86_64.zip + jlink --module-path java-*.windows.ojdkbuild.x86_64/jmods --add-modules java.se,jdk.charsets --output out/jre + rm -rf java-*.windows.ojdkbuild.x86_64 + wine app/ISCC.exe traccar.iss >/dev/null + rm -rf out/jre + zip -q -j traccar-windows-64-$VERSION.zip Output/traccar-setup.exe README.txt + rm -r Output + ok "Created Windows 64 installer" +} - cp java-test/test.jar out +package_linux () { cp setup.sh out - makeself --notemp out traccar.run "traccar" ./setup.sh + cp traccar.service out - zip -j traccar-linux-$VERSION.zip traccar.run README.txt - cp traccar-linux-$VERSION.zip traccar-macos-$VERSION.zip + unzip -q -o jdk-*-linux-$1.zip + jlink --module-path jdk-*-linux-$1/jmods --add-modules java.se,jdk.charsets --output out/jre + rm -rf jdk-*-linux-$1 + makeself --quiet --notemp out traccar.run "traccar" ./setup.sh + rm -rf out/jre + + zip -q -j traccar-linux-$2-$VERSION.zip traccar.run README.txt rm traccar.run - rm -r out + rm out/setup.sh + rm out/traccar.service } -package_universal () { - mkdir -p out/{conf,data,lib,logs,web,schema,templates} - - copy_files - - cp README.txt out - cp other/traccar.sh out - - cd out - zip -r ../traccar-other-$VERSION.zip * - cd .. +package_linux_64 () { + info "Building Linux 64 installer" + package_linux x64 64 + ok "Created Linux 64 installer" +} - rm -rf out/ +package_linux_arm () { + info "Building Linux ARM installer" + package_linux armhf arm + ok "Created Linux ARM installer" } prepare -package_windows -package_unix -package_universal +case $PLATFORM in + all) + package_linux_64 + package_linux_arm + package_windows + package_other + ;; + + linux-64) + package_linux_64 + ;; + + linux-arm) + package_linux_arm + ;; + + windows-64) + package_windows + ;; + + other) + package_other + ;; +esac cleanup + +ok "Done" diff --git a/setup/setup.sh b/setup/setup.sh index 39a00d8e8..7443c3b4e 100755 --- a/setup/setup.sh +++ b/setup/setup.sh @@ -1,18 +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 - /opt/traccar/bin/installDaemon.sh - else - echo 'Java 7 or higher is required' - fi -else - echo 'Java runtime is required' -fi +mkdir -p /opt/traccar +cp -r * /opt/traccar +chmod -R go+rX /opt/traccar + +mv /opt/traccar/traccar.service /etc/systemd/system +chmod 664 /etc/systemd/system/traccar.service + +systemctl daemon-reload +systemctl enable traccar.service + +rm /opt/traccar/setup.sh +rm -r ../out diff --git a/setup/traccar.iss b/setup/traccar.iss index 3d6c1a872..e66f38b6d 100644 --- a/setup/traccar.iss +++ b/setup/traccar.iss @@ -1,52 +1,19 @@ [Setup] AppName=Traccar -AppVersion=3.14 +AppVersion=4.7 DefaultDirName={pf}\Traccar -AlwaysRestart=yes OutputBaseFilename=traccar-setup ArchitecturesInstallIn64BitMode=x64 [Dirs] -Name: "{app}\bat" -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: "{app}\bat\installService.bat"; Parameters: ">%TEMP%\installService.log 2>&1"; Flags: runhidden +Filename: "{app}\jre\bin\java.exe"; Parameters: "-jar ""{app}\tracker-server.jar"" --install .\conf\traccar.xml"; Flags: runhidden [UninstallRun] -Filename: "{app}\bat\uninstallService.bat"; Parameters: ">%TEMP%\uninstallService.log 2>&1"; 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\Java Runtime Environment') 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/traccar.service b/setup/traccar.service new file mode 100644 index 000000000..fe746dda8 --- /dev/null +++ b/setup/traccar.service @@ -0,0 +1,13 @@ +[Unit] +Description=traccar +After=network.target + +[Service] +Type=simple +WorkingDirectory=/opt/traccar +ExecStart=/opt/traccar/jre/bin/java -jar tracker-server.jar conf/traccar.xml +SyslogIdentifier=traccar +SuccessExitStatus=143 + +[Install] +WantedBy=multi-user.target |