31 lines
805 B
Bash
31 lines
805 B
Bash
#! /bin/sh
|
|
|
|
set -e
|
|
|
|
. /etc/zm/zm.conf
|
|
|
|
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
|
|
|
|
# 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 $?
|
|
|
|
if [ "$ZM_DB_HOST" = "localhost" ]; then
|
|
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
|
|
else
|
|
echo "Not doing database upgrade due to remote db server ($ZM_DB_HOST)"
|
|
fi;
|
|
|
|
fi
|
|
|
|
#DEBHELPER#
|