Add directory creation for host path in

generate-traccar-config and
generate-traccar-config-for-casaos
This commit is contained in:
Christopher
2023-11-14 10:06:19 -06:00
parent ad005ac8bb
commit 7f88120053
2 changed files with 12 additions and 0 deletions

View File

@@ -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

View File

@@ -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."