Invert the logic
This commit is contained in:
parent
1b1a2e5a3d
commit
a0095ec7fd
|
@ -902,26 +902,26 @@ function create_restore_script {
|
||||||
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
|
|
||||||
if [[ $BACKUP_INCLUDES_DATABASES == "yes" ]]; then
|
if [[ $BACKUP_INCLUDES_DATABASES == "yes" ]]; then
|
||||||
echo "if [ ! -d $USB_MOUNT/backup/mariadb ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo "if [ -d $USB_MOUNT/backup/mariadb ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' echo "Restoring mysql settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' echo "Restoring mysql settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' if [ ! -d /root/tempmariadb ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' if [ ! -d /root/tempmariadb ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' mkdir /root/tempmariadb' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' mkdir /root/tempmariadb' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/mariadb /root/tempmariadb $USB_MOUNT/backup/mariadb.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo " rsyncrypto -v -d -r $USB_MOUNT/backup/mariadb /root/tempmariadb $USB_MOUNT/backup/mariadb.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' echo "Get the MariaDB password from the backup"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' echo "Get the MariaDB password from the backup"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' if [ ! -f /root/tempmariadb/usb/backup/mariadb/db ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' if [ ! -f /root/tempmariadb/usb/backup/mariadb/db ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' echo "MariaDB password file not found"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' echo "MariaDB password file not found"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' exit 495' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' exit 495' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' BACKUP_MARIADB_PASSWORD=$(</root/tempmariadb/usb/backup/mariadb/db)' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' BACKUP_MARIADB_PASSWORD=$(</root/tempmariadb/usb/backup/mariadb/db)' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' echo "Restore the MariaDB user table"' >> /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/mysql.sql' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' mysql -u root --password=$DATABASE_PASSWORD mysql -o < /root/tempmariadb/usb/backup/mariadb/mysql.sql' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' shred -zu /root/tempmariadb/usb/backup/mariadb/db' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' shred -zu /root/tempmariadb/usb/backup/mariadb/db' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' rm -rf /root/tempmariadb' >> /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
|
echo ' echo "Apply the new MariaDB user table"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' mysql -u root --password=$DATABASE_PASSWORD "flush privileges;"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' mysql -u root --password=$DATABASE_PASSWORD "flush privileges;"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' echo "Change the MariaDB password to the backup version"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' echo "Change the MariaDB password to the backup version"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo ' DATABASE_PASSWORD=$BACKUP_MARIADB_PASSWORD' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo ' DATABASE_PASSWORD=$BACKUP_MARIADB_PASSWORD' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue