> Something like the attached patch? (Untested)
Had more time than I thought; updated and (quickly) tested patch
attached.
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` [email protected] / chris-lamb.co.uk
`-
diff --git a/debian/rules b/debian/rules
index f4a187f..9bf025b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -64,6 +64,10 @@ override_dh_auto_install:
dh_auto_install --arch --destdir=$(CURDIR)/debian/tmp
# remove empty directories:
-find $(CURDIR)/debian/tmp/usr -mindepth 1 -type d -empty -delete
-printf 'removed %p\n'
+
+ # Don't ship core.php as it contains pre-generated/static salts. We
+ # keep core.php.default as a template for the postinst.
+ rm -f
$(CURDIR)/debian/tmp/usr/share/zoneminder/www/api/app/Config/core.php
override_dh_install:
dh_install -XLICENSE -XLICENSE.txt -X.gitignore
diff --git a/debian/zoneminder.links b/debian/zoneminder.links
index 06dd74e..b1e1e96 100644
--- a/debian/zoneminder.links
+++ b/debian/zoneminder.links
@@ -8,3 +8,5 @@
/usr/share/man/man8/zoneminder-zmf.8.gz
/usr/share/man/man8/zmf.8.gz
/usr/share/man/man8/zoneminder-zmstreamer.8.gz
/usr/share/man/man8/zmstreamer.8.gz
/usr/share/man/man8/zoneminder-zmu.8.gz
/usr/share/man/man8/zmu.8.gz
+
+/etc/zm/core.php /usr/share/zoneminder/www/api/app/Config/core.php
diff --git a/debian/zoneminder.postinst b/debian/zoneminder.postinst
index b50b38a..a5700e5 100644
--- a/debian/zoneminder.postinst
+++ b/debian/zoneminder.postinst
@@ -2,6 +2,9 @@
set -e
+TARGET="/etc/zm/core.php"
+SOURCE="/usr/share/zoneminder/www/api/app/Config/core.php.default"
+
Generate_random () {
tr -dc $1 < /dev/urandom | head -c $2
}
@@ -13,10 +16,15 @@ if [ "$1" = "configure" ]; then
chown www-data:www-data -R /var/cache/zoneminder
fi
- sed -i \
- -e "s@__ZM_API_SALT__@$(Generate_random A-Za-z0-9
29)@g" \
- -e "s@__ZM_API_SEED__@$(Generate_random 0-9 40)@g" \
- /usr/share/zoneminder/www/api/app/Config/core.php
+ if [ ! -e "${TARGET}" ]
+ then
+ echo "I: Generating ${TARGET} from ${SOURCE} ..." >&2
+
+ sed \
+ -e "s@__ZM_API_SALT__@$(Generate_random
A-Za-z0-9 29)@g" \
+ -e "s@__ZM_API_SEED__@$(Generate_random 0-9
40)@g" \
+ ${SOURCE} > ${TARGET}
+ fi
fi
#DEBHELPER#