From 02f2c86d430d95b275a6e60498e28316c5b7ad4c Mon Sep 17 00:00:00 2001 From: Bluemax <1403092+BlueMax@users.noreply.github.com> Date: Thu, 12 Nov 2020 01:32:15 +0100 Subject: [PATCH] Honor conf.d (zmlinkcontent.sh) Signed-off-by: Bluemax <1403092+BlueMax@users.noreply.github.com> --- zmlinkcontent.sh.in | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/zmlinkcontent.sh.in b/zmlinkcontent.sh.in index 409202cb1..f6e170ffa 100755 --- a/zmlinkcontent.sh.in +++ b/zmlinkcontent.sh.in @@ -88,16 +88,19 @@ if [[ -n "$ZM_CONFIG" && ! -f "$ZM_CONFIG" ]]; then fi # Load zm.conf -if [ -n "$ZM_CONFIG" ]; then - echo "Using custom zm.conf $ZM_CONFIG" - source "$ZM_CONFIG" -elif [ -f "zm.conf" ]; then - echo "Using local zm.conf" - source "zm.conf" -elif [ -f "/etc/zm.conf" ]; then - echo "Using system zm.conf" - source "/etc/zm.conf" -else +for zmconf in "$ZM_CONFIG" ./zm.conf /etc/zm.conf /etc/zoneminder/zm.conf; do + if [[ -f "$zmconf" ]]; then + echo "Using $zmconf" + source "$zmconf" + # remove filename from path + zmconf2="${zmconf%/*}" + # source conf.d + for i in $(find "${zmconf2}/conf.d" -name \*.conf |sort); do . "$i"; done; + break + fi +done + +if [[ -z "$zmconf2" ]]; then echo -e "Failed locating zoneminder configuration file (zm.conf)\nUse the -z option to specify the full path to the zoneminder configuration file" exit 45 fi