Fail postinst if zmupdate fails

This commit is contained in:
Isaac Connor 2021-04-19 11:51:35 -04:00
parent c1035b7ffd
commit 484ff7dbaa
2 changed files with 16 additions and 0 deletions

View File

@ -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

View File

@ -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