> Well, you don't edit shipped files. Neither conffiles nor normal files. > Instead, you put these values into a new file (not a shipped file!, > maybe ship a template in /usr/share/$pkg) in either /etc or /var (with a > symlink in /usr pointing to it) that is solely managed by the maintainer > scripts.
Something like the attached patch? (Untested) > * upon initial installation only? Yes, as otherwise you're invalidating all user sessions (or even all passwords!) > > I guess you guys can have an interesting discussion about clash between > > #830979 and #831984. This seems an odd.attitude to have as the maintainer.. :) Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
diff --git a/debian/rules b/debian/rules index f4a187f..f7a120c 100755 --- a/debian/rules +++ b/debian/rules @@ -11,6 +11,8 @@ ifeq ($(DEB_BUILD_ARCH_OS),hurd) ARGS:= -DZM_NO_MMAP=ON endif +CORE_PHP = $(CURDIR)/debian/tmp/usr/share/zoneminder/www/api/app/Config/core.php + %: dh $@ --parallel --buildsystem=cmake --builddirectory=dbuild \ --with systemd,sphinxdoc,apache2,linktree @@ -64,6 +66,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 $(CORE_PHP) override_dh_install: dh_install -XLICENSE -XLICENSE.txt -X.gitignore diff --git a/debian/zoneminder.postinst b/debian/zoneminder.postinst index b50b38a..ec33890 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,13 @@ 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 + 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#