From 2de36f01db2e30add71fa83d38496b15699a738b Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 28 Oct 2021 12:46:42 -0400 Subject: [PATCH] Handle auth to mysql problems more gracefully --- distros/ubuntu2004/zoneminder.postinst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/distros/ubuntu2004/zoneminder.postinst b/distros/ubuntu2004/zoneminder.postinst index 4be136a71..6f26bca24 100644 --- a/distros/ubuntu2004/zoneminder.postinst +++ b/distros/ubuntu2004/zoneminder.postinst @@ -5,6 +5,12 @@ set +e create_db () { echo "Checking for db" mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload + if [ $? -ne 0 ]; then + echo "Cannot talk to database. You will have to create the db manually with something like:"; + echo "cat /usr/share/zoneminder/db/zm_create.sql | mysql -u root"; + return; + fi + # test if database if already present... if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then echo "Creating zm db"