Merge pull request #5480 from AJ0070/4300-postinst-conf-parse

fix: parse zm.conf in postinst instead of sourcing it
This commit is contained in:
Isaac Connor authored and GitHub committed 2026-11-11 08:59:24 -05:00
commit 5b52f6ea33
2 files changed
+24 -4

No files matched your search

+12 -2
View File
@@ -2,11 +2,21 @@
set -e
# zm.conf is not shell; read it the way ZoneMinder's PHP and Perl readers do.
zm_load_config () {
[ -r "$1" ] || return 0
while IFS=' ' read -r zm_name zm_value; do
eval "$zm_name=\$zm_value"
done <<EOF
$(sed -e :a -e '/\\[[:space:]]*$/{N;s/\\[[:space:]]*\n[[:space:]]*//;ta' -e '}' "$1" | sed -n "s/^[[:space:]]*\([A-Za-z_][A-Za-z0-9_]*\)[[:space:]]*=[[:space:]]*[\"']*\(.*\)/\1 \2/p" | sed "s/[\"'[:space:]]*\$//")
EOF
}
if [ "$1" = "configure" ]; then
. /etc/zm/zm.conf
zm_load_config /etc/zm/zm.conf
for i in /etc/zm/conf.d/*.conf; do
. $i
zm_load_config "$i"
done;
+12 -2
View File
@@ -56,11 +56,21 @@ update_db () {
echo "Done Updating"
}
# zm.conf is not shell; read it the way ZoneMinder's PHP and Perl readers do.
zm_load_config () {
[ -r "$1" ] || return 0
while IFS=' ' read -r zm_name zm_value; do
eval "$zm_name=\$zm_value"
done <<EOF
$(sed -e :a -e '/\\[[:space:]]*$/{N;s/\\[[:space:]]*\n[[:space:]]*//;ta' -e '}' "$1" | sed -n "s/^[[:space:]]*\([A-Za-z_][A-Za-z0-9_]*\)[[:space:]]*=[[:space:]]*[\"']*\(.*\)/\1 \2/p" | sed "s/[\"'[:space:]]*\$//")
EOF
}
if [ "$1" = "configure" ]; then
. /etc/zm/zm.conf
zm_load_config /etc/zm/zm.conf
for CONFFILE in /etc/zm/conf.d/*.conf; do
. "$CONFFILE"
zm_load_config "$CONFFILE"
done
# The logs can contain passwords, etc... so by setting group root, only www-data can read them, not people in the www-data group