From 484ff7dbaa7a715a406e055b7a58ca453ee3aed2 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 19 Apr 2021 11:51:35 -0400 Subject: [PATCH] Fail postinst if zmupdate fails --- distros/ubuntu1604/zoneminder.postinst | 8 ++++++++ distros/ubuntu2004/zoneminder.postinst | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/distros/ubuntu1604/zoneminder.postinst b/distros/ubuntu1604/zoneminder.postinst index e51abb5a9..fa634d11d 100644 --- a/distros/ubuntu1604/zoneminder.postinst +++ b/distros/ubuntu1604/zoneminder.postinst @@ -69,7 +69,15 @@ if [ "$1" = "configure" ]; then echo "GRANT LOCK TABLES,ALTER,DROP,SELECT,INSERT,UPDATE,DELETE,CREATE,INDEX,ALTER ROUTINE,CREATE ROUTINE, TRIGGER,EXECUTE,REFERENCES ON ${ZM_DB_NAME}.* TO '${ZM_DB_USER}'@localhost;" | mysql --defaults-file=/etc/mysql/debian.cnf mysql zmupdate.pl --nointeractive + if [ $? -ne 0 ]; then + echo "Error updating db." + exit 1; + fi zmupdate.pl --nointeractive -f + if [ $? -ne 0 ]; then + echo "Error updating config." + exit 1; + fi # Add any new PTZ control configurations to the database (will not overwrite) zmcamtool.pl --import >/dev/null 2>&1 diff --git a/distros/ubuntu2004/zoneminder.postinst b/distros/ubuntu2004/zoneminder.postinst index b0fd254f5..8e415bc86 100644 --- a/distros/ubuntu2004/zoneminder.postinst +++ b/distros/ubuntu2004/zoneminder.postinst @@ -32,7 +32,15 @@ create_update_user () { update_db () { zmupdate.pl --nointeractive + if [ $? -ne 0 ]; then + echo "Error updating db." + exit 1; + fi zmupdate.pl --nointeractive -f + if [ $? -ne 0 ]; then + echo "Error updating config." + exit 1; + fi # Add any new PTZ control configurations to the database (will not overwrite) zmcamtool.pl --import >/dev/null 2>&1