From 7f8812005336158bcedb58a2b726ed5dedfb6af3 Mon Sep 17 00:00:00 2001 From: Christopher Date: Tue, 14 Nov 2023 10:06:19 -0600 Subject: [PATCH] Add directory creation for host path in generate-traccar-config and generate-traccar-config-for-casaos --- generate-traccar-config-for-casaos/run.sh | 6 ++++++ generate-traccar-config/run.sh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/generate-traccar-config-for-casaos/run.sh b/generate-traccar-config-for-casaos/run.sh index 20f5b4c..e55b6ad 100644 --- a/generate-traccar-config-for-casaos/run.sh +++ b/generate-traccar-config-for-casaos/run.sh @@ -28,6 +28,12 @@ if [ -z "$host_path" ]; then host_path="/DATA/AppData/big-bear-traccar/traccar.xml" fi +# Extract the directory part from the provided path +host_dir=$(dirname "$host_path") + +# Create the directory if it does not exist +mkdir -p "$host_dir" + # If the directory exists, ask the user if they want to remove it. # Otherwise, exit without removing the directory. if [ -d "$host_path" ]; then diff --git a/generate-traccar-config/run.sh b/generate-traccar-config/run.sh index eb22881..747d5dd 100644 --- a/generate-traccar-config/run.sh +++ b/generate-traccar-config/run.sh @@ -28,6 +28,12 @@ if [ -z "$host_path" ]; then host_path="/DATA/AppData/traccar/traccar.xml" fi +# Extract the directory part from the provided path +host_dir=$(dirname "$host_path") + +# Create the directory if it does not exist +mkdir -p "$host_dir" + # Check if the specified path is a directory. if [ -d "$host_path" ]; then echo "Error: $host_path is a directory."