From 6b994132f153b522767bf6efb3c30aaf553ea717 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 9 Nov 2015 12:34:11 -0500 Subject: [PATCH 1/4] grant create,index to zmuser when updating --- distros/debian/postinst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/distros/debian/postinst b/distros/debian/postinst index d06f9c641..17d308fe4 100644 --- a/distros/debian/postinst +++ b/distros/debian/postinst @@ -15,7 +15,7 @@ if [ "$1" = "configure" ]; then # test if database if already present... if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf - echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql + echo 'grant lock tables, alter,select,insert,update,delete,create,index on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql fi invoke-rc.d zoneminder stop || true @@ -47,6 +47,8 @@ if [ "$1" = "configure" ]; then chown www-data:www-data -R /var/cache/zoneminder else chown www-data:www-data /var/log/zm + + echo 'grant lock tables, create, index, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysq zmupdate.pl fi fi From 82edfc2f1681778db2cd38764969a29b23604ba9 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 9 Nov 2015 12:34:24 -0500 Subject: [PATCH 2/4] grant create,index to zmuser when updating --- distros/ubuntu1504_cmake/zoneminder.postinst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/distros/ubuntu1504_cmake/zoneminder.postinst b/distros/ubuntu1504_cmake/zoneminder.postinst index e7810e468..e85dcf3ff 100644 --- a/distros/ubuntu1504_cmake/zoneminder.postinst +++ b/distros/ubuntu1504_cmake/zoneminder.postinst @@ -8,6 +8,16 @@ if [ "$1" = "configure" ]; then 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 $? + + # Run the ZoneMinder update tool + zmupdate.pl --nointeractive + fi #DEBHELPER# From ac76d224b8d17a8927bfd13e531a3766e8b6fe82 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 9 Nov 2015 12:36:23 -0500 Subject: [PATCH 3/4] grant create,index to zmuser when updating --- distros/ubuntu1504_cmake/zoneminder.postinst | 1 + 1 file changed, 1 insertion(+) diff --git a/distros/ubuntu1504_cmake/zoneminder.postinst b/distros/ubuntu1504_cmake/zoneminder.postinst index e85dcf3ff..4d2da7331 100644 --- a/distros/ubuntu1504_cmake/zoneminder.postinst +++ b/distros/ubuntu1504_cmake/zoneminder.postinst @@ -15,6 +15,7 @@ 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 From 16274e46bcbbf1c199e4d6f5afe4d2e5823df59d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 9 Nov 2015 12:36:26 -0500 Subject: [PATCH 4/4] grant create,index to zmuser when updating --- distros/debian/postinst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/debian/postinst b/distros/debian/postinst index 17d308fe4..42a3bb1dc 100644 --- a/distros/debian/postinst +++ b/distros/debian/postinst @@ -48,7 +48,7 @@ if [ "$1" = "configure" ]; then else chown www-data:www-data /var/log/zm - echo 'grant lock tables, create, index, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysq + echo 'grant lock tables, create, index, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql zmupdate.pl fi fi