Migrate Traccar config out of Home Assistant config folder (#261)

This commit is contained in:
Franck Nijhof 2023-11-10 22:13:46 +01:00 committed by GitHub
parent 1a6c19c124
commit 61469fcf05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View file

@ -106,7 +106,7 @@ been done to reduce the number of open ports the add-on would create.
By default, only the OsmAnd protocol (used by the Traccar Apps) and the API By default, only the OsmAnd protocol (used by the Traccar Apps) and the API
are enabled. If you want more protocols, you can do so, by adding entries are enabled. If you want more protocols, you can do so, by adding entries
to your `/config/traccar.xml` file. to your `traccar.xml` file in the add-on configuration folder.
A list if all entries can be found here: A list if all entries can be found here:

View file

@ -18,7 +18,8 @@ ports:
ports_description: ports_description:
80/tcp: Web interface 80/tcp: Web interface
map: map:
- config:rw - addon_config:rw
- homeassistant_config:rw
- ssl - ssl
services: services:
- mysql:want - mysql:want

View file

@ -8,6 +8,14 @@ declare password
declare port declare port
declare username declare username
# Migrate add-on data from the Home Assistant config folder,
# to the add-on configuration folder.
if ! bashio::fs.directory_exists '/config/traccar.xml' \
&& bashio::fs.file_exists '/homeassistant/traccar.xml'; then
mv /homeassistant/traccar.xml /config/traccar.xml \
|| bashio::exit.nok "Failed to migrate Traccar configuration"
fi
if ! bashio::fs.file_exists "/config/traccar.xml"; then if ! bashio::fs.file_exists "/config/traccar.xml"; then
cp /etc/traccar/traccar.xml /config/traccar.xml cp /etc/traccar/traccar.xml /config/traccar.xml
else else