summaryrefslogtreecommitdiff
path: root/astro/traccar/files
diff options
context:
space:
mode:
Diffstat (limited to 'astro/traccar/files')
-rw-r--r--astro/traccar/files/pkg-message.in16
-rw-r--r--astro/traccar/files/traccar.in42
-rw-r--r--astro/traccar/files/traccar.xml.in12
3 files changed, 70 insertions, 0 deletions
diff --git a/astro/traccar/files/pkg-message.in b/astro/traccar/files/pkg-message.in
new file mode 100644
index 000000000000..b1c5f995831c
--- /dev/null
+++ b/astro/traccar/files/pkg-message.in
@@ -0,0 +1,16 @@
+[
+{ type: install
+ message: <<EOM
+
+Traccar was sucesfully installed in the %%PREFIX%%/traccar.
+
+- configuration file: %%ETCDIR%%/traccar.xml
+- logs: %%TRACCAR_LOGDIR%%
+- H2 database files: %%TRACCAR_DATADIR%%
+
+It is not recommended to use H2 database for production.
+Edit %%ETCDIR%%/traccar.xml according to documentation at
+https://www.traccar.org/documentation/ to use another SQL database
+EOM
+}
+]
diff --git a/astro/traccar/files/traccar.in b/astro/traccar/files/traccar.in
new file mode 100644
index 000000000000..e0df44a400b7
--- /dev/null
+++ b/astro/traccar/files/traccar.in
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# PROVIDE: traccar
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+
+# Add the following lines to /etc/rc.conf to enable traccar:
+#
+# traccar_enable (bool): Set to YES to enable traccar
+# Default: NO
+# traccar_flags (str): Extra flags passed to traccar
+# traccar_config (str): traccar configuration directory
+# Default: ${PREFIX}/etc/beats
+# traccar_conffile (str): traccar configuration file
+# relative to ${traccar_conf}
+# Default: traccar.xml
+
+. /etc/rc.subr
+
+name="traccar"
+rcvar=${name}_enable
+load_rc_config $name
+
+: ${traccar_enable:="NO"}
+: ${traccar_config:="%%ETCDIR%%/traccar.xml"}
+: ${traccar_home:="%%PREFIX%%/traccar"}
+: ${traccar_logs:="%%TRACCAR_LOGDIR%%"}
+
+# daemon
+start_precmd=traccar_prestart
+command=/usr/sbin/daemon
+pidfile="/var/run/${name}"
+command_args="-frP ${pidfile} --user traccar %%PREFIX%%/bin/java -jar tracker-server.jar ${traccar_flags} ${traccar_config}"
+
+traccar_prestart() {
+# Have to empty rc_flags so they don't get passed to daemon(8)
+ rc_flags=""
+ cd ${traccar_home}
+}
+
+run_rc_command "$1"
diff --git a/astro/traccar/files/traccar.xml.in b/astro/traccar/files/traccar.xml.in
new file mode 100644
index 000000000000..895e4bcf9ee4
--- /dev/null
+++ b/astro/traccar/files/traccar.xml.in
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
+<properties>
+
+ <!-- Documentation: https://www.traccar.org/configuration-file/ -->
+
+ <entry key='database.driver'>org.h2.Driver</entry>
+ <entry key='database.url'>jdbc:h2:%%TRACCAR_DATADIR%%/database</entry>
+ <entry key='database.user'>sa</entry>
+ <entry key='database.password'></entry>
+ <entry key='logger.file'>%%TRACCAR_LOGDIR%%/traccar.log</entry>
+</properties>