2015-08-18 02:03:27 +08:00
#! /bin/sh
set -e
2015-11-28 02:54:31 +08:00
. /etc/zm/zm.conf
2015-08-18 02:03:27 +08:00
if [ "$1" = "configure" ]; then
chown www-data:root /var/log/zm
chown www-data:www-data /var/lib/zm
if [ -z "$2" ]; then
chown www-data:www-data -R /var/cache/zoneminder
fi
2015-11-10 01:34:24 +08:00
# Do this every time the package is installed or upgraded
# Test for database presence to avoid failure of zmupdate.pl
# Ensure zoneminder is stopped
deb-systemd-invoke stop zoneminder.service || exit $?
2015-12-04 23:40:55 +08:00
if [ "$ZM_DB_HOST" = "localhost" ]; then
2015-11-28 02:54:31 +08:00
echo 'grant lock tables, create, index, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
# Run the ZoneMinder update tool
zmupdate.pl --nointeractive
2015-12-03 00:17:23 +08:00
else
echo "Not doing database upgrade due to remote db server ($ZM_DB_HOST)"
2015-11-28 02:54:31 +08:00
fi;
2015-11-10 01:34:24 +08:00
2015-08-18 02:03:27 +08:00
fi
#DEBHELPER#