aboutsummaryrefslogtreecommitdiff
path: root/setup/setup.sh
diff options
context:
space:
mode:
authorMichel Verbraak <michel.verbraak@politie.nl>2020-10-22 09:44:30 +0200
committerMichel Verbraak <michel.verbraak@politie.nl>2020-10-27 08:37:42 +0100
commit07cb0b443700041da16510f3594cebfc69ce9051 (patch)
tree104a9ee8416ea92005f79941fb48b7af52680dc6 /setup/setup.sh
parentc686a4f045f15944940e131ccfb2fa6a1e0a5e7c (diff)
downloadtrackermap-server-07cb0b443700041da16510f3594cebfc69ce9051.tar.gz
trackermap-server-07cb0b443700041da16510f3594cebfc69ce9051.tar.bz2
trackermap-server-07cb0b443700041da16510f3594cebfc69ce9051.zip
Preserve existing traccar.xml on update
Diffstat (limited to 'setup/setup.sh')
-rwxr-xr-xsetup/setup.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/setup/setup.sh b/setup/setup.sh
index 7443c3b4e..1b07990ae 100755
--- a/setup/setup.sh
+++ b/setup/setup.sh
@@ -1,9 +1,21 @@
#!/bin/sh
+PRESERVECONFIG=0
+if [ -f /opt/traccar/conf/traccar.xml ]
+then
+ cp /opt/traccar/conf/traccar.xml /opt/traccar/conf/traccar.xml.saved
+ PRESERVECONFIG=1
+fi
+
mkdir -p /opt/traccar
cp -r * /opt/traccar
chmod -R go+rX /opt/traccar
+if [ ${PRESERVECONFIG} -eq 1 ] && [ -f /opt/traccar/conf/traccar.xml.saved ]
+then
+ mv -f /opt/traccar/conf/traccar.xml.saved /opt/traccar/conf/traccar.xml
+fi
+
mv /opt/traccar/traccar.service /etc/systemd/system
chmod 664 /etc/systemd/system/traccar.service