From 32a41779422f0b9c5a7c58f36ae8016f920c9dde Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Tue, 22 Mar 2022 09:34:27 +0100
Subject: [PATCH] mysql dump: return error on dumps without data

---
 plugins/localdump/mysql.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/plugins/localdump/mysql.sh b/plugins/localdump/mysql.sh
index 7c834a3..4f69c25 100755
--- a/plugins/localdump/mysql.sh
+++ b/plugins/localdump/mysql.sh
@@ -95,12 +95,13 @@ function mysql.db.dump(){
 
   zgrep -iE "(CREATE|INSERT)" "$_dumpfile" >/dev/null
   typeset -i local _rc2=$?
-  test $_rc2 -ne 0 && echo "ERROR: the dump does not contain an insert statement."
+  test $_rc2 -ne 0 && echo "ERROR: the dump does not contain any CREATE or INSERT statement."
 
-  typeset -i local _rctotal=$?+$_rc2
-  test $_rctotal -eq 0 && mysql_COUNT_DUMPS+=1
-  test $_rctotal -eq 0 || mysql_COUNT_ERRORS+=1
-  test $_rctotal -eq 0
+  typeset -i local myrc+=$_rc2
+  test $myrc -eq 0 && mysql_COUNT_DUMPS+=1
+  test $myrc -eq 0 || mysql_COUNT_ERRORS+=1
+
+  test $myrc -eq 0  
 }
 
 # import [file] --> [database] 
-- 
GitLab