diff --git a/distros/ubuntu1504_cmake/zoneminder.postinst b/distros/ubuntu1504_cmake/zoneminder.postinst index 4d2da7331..82b256e6b 100644 --- a/distros/ubuntu1504_cmake/zoneminder.postinst +++ b/distros/ubuntu1504_cmake/zoneminder.postinst @@ -2,6 +2,8 @@ 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 @@ -15,9 +17,13 @@ if [ "$1" = "configure" ]; then # 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 + 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