zoneminder/distros/ubuntu1504_cmake/zoneminder.postinst

25 lines
661 B
Bash

#! /bin/sh
set -e
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 $?
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
fi
#DEBHELPER#