From af3d6a14de0b08b3341a15b7ee0446951b343eab Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 13 Dec 2014 20:04:06 +0000 Subject: [PATCH] Exit on mysql command failure --- install-freedombone.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install-freedombone.sh b/install-freedombone.sh index d9c51f46..a04e3bf0 100755 --- a/install-freedombone.sh +++ b/install-freedombone.sh @@ -915,7 +915,11 @@ function create_restore_script { echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' BACKUP_MARIADB_PASSWORD=$(> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Restore the MariaDB user table"' >> /usr/bin/$RESTORE_SCRIPT_NAME - echo ' mysql -u root --password=$DATABASE_PASSWORD mysql -o < /root/tempmariadb/usb/backup/mariadb/tempmariadb/mysql.sql' >> /usr/bin/$RESTORE_SCRIPT_NAME + echo ' mysqlsuccess=$(mysql -u root --password=$DATABASE_PASSWORD mysql -o < /root/tempmariadb/usb/backup/mariadb/tempmariadb/mysql.sql)' >> /usr/bin/$RESTORE_SCRIPT_NAME + echo ' if [ ! "$mysqlsuccess" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME + echo ' echo "$mysqlsuccess"' >> /usr/bin/$RESTORE_SCRIPT_NAME + echo ' exit 962' >> /usr/bin/$RESTORE_SCRIPT_NAME + echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' shred -zu /root/tempmariadb/usb/backup/mariadb/tempmariadb/db' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' rm -rf /root/tempmariadb' >> /usr/bin/$RESTORE_SCRIPT_NAME echo ' echo "Apply the new MariaDB user table"' >> /usr/bin/$RESTORE_SCRIPT_NAME