|
@@ -902,26 +902,26 @@ function create_restore_script {
|
902
|
902
|
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
903
|
903
|
|
904
|
904
|
if [[ $BACKUP_INCLUDES_DATABASES == "yes" ]]; then
|
905
|
|
- echo "if [ ! -d $USB_MOUNT/backup/mariadb ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
|
906
|
|
- echo ' echo "Restoring mysql settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
907
|
|
- echo ' if [ ! -d /root/tempmariadb ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
908
|
|
- echo ' mkdir /root/tempmariadb' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
909
|
|
- echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
910
|
|
- echo " rsyncrypto -v -d -r $USB_MOUNT/backup/mariadb /root/tempmariadb $USB_MOUNT/backup/mariadb.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
|
911
|
|
- echo ' echo "Get the MariaDB password from the backup"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
912
|
|
- echo ' if [ ! -f /root/tempmariadb/usb/backup/mariadb/db ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
913
|
|
- echo ' echo "MariaDB password file not found"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
914
|
|
- echo ' exit 495' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
915
|
|
- echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
916
|
|
- echo ' BACKUP_MARIADB_PASSWORD=$(</root/tempmariadb/usb/backup/mariadb/db)' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
917
|
|
- echo ' echo "Restore the MariaDB user table"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
918
|
|
- echo ' mysql -u root --password=$DATABASE_PASSWORD mysql -o < /root/tempmariadb/usb/backup/mariadb/mysql.sql' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
919
|
|
- echo ' shred -zu /root/tempmariadb/usb/backup/mariadb/db' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
920
|
|
- echo ' rm -rf /root/tempmariadb' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
921
|
|
- echo ' echo "Apply the new MariaDB user table"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
922
|
|
- echo ' mysql -u root --password=$DATABASE_PASSWORD "flush privileges;"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
923
|
|
- echo ' echo "Change the MariaDB password to the backup version"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
924
|
|
- echo ' DATABASE_PASSWORD=$BACKUP_MARIADB_PASSWORD' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
905
|
+ echo "if [ -d $USB_MOUNT/backup/mariadb ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
906
|
+ echo ' echo "Restoring mysql settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
907
|
+ echo ' if [ ! -d /root/tempmariadb ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
908
|
+ echo ' mkdir /root/tempmariadb' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
909
|
+ echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
910
|
+ echo " rsyncrypto -v -d -r $USB_MOUNT/backup/mariadb /root/tempmariadb $USB_MOUNT/backup/mariadb.keys $BACKUP_CERTIFICATE" >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
911
|
+ echo ' echo "Get the MariaDB password from the backup"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
912
|
+ echo ' if [ ! -f /root/tempmariadb/usb/backup/mariadb/db ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
913
|
+ echo ' echo "MariaDB password file not found"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
914
|
+ echo ' exit 495' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
915
|
+ echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
916
|
+ echo ' BACKUP_MARIADB_PASSWORD=$(</root/tempmariadb/usb/backup/mariadb/db)' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
917
|
+ echo ' echo "Restore the MariaDB user table"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
918
|
+ echo ' mysql -u root --password=$DATABASE_PASSWORD mysql -o < /root/tempmariadb/usb/backup/mariadb/mysql.sql' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
919
|
+ echo ' shred -zu /root/tempmariadb/usb/backup/mariadb/db' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
920
|
+ echo ' rm -rf /root/tempmariadb' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
921
|
+ echo ' echo "Apply the new MariaDB user table"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
922
|
+ echo ' mysql -u root --password=$DATABASE_PASSWORD "flush privileges;"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
923
|
+ echo ' echo "Change the MariaDB password to the backup version"' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
|
924
|
+ echo ' DATABASE_PASSWORD=$BACKUP_MARIADB_PASSWORD' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
925
|
925
|
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
926
|
926
|
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
|
927
|
927
|
fi
|