From 5df28375eb1742a5a31b99cc9299cded75ca79e3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Dec 2015 12:31:43 +0000 Subject: [PATCH] Remote restore of configuration files --- src/freedombone-restore-local | 4 ++-- src/freedombone-restore-remote | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/freedombone-restore-local b/src/freedombone-restore-local index 853d8e87..66ccee2c 100755 --- a/src/freedombone-restore-local +++ b/src/freedombone-restore-local @@ -231,13 +231,13 @@ function restore_configuration { if [ -d $USB_MOUNT/backup/config ]; then echo $"Restoring configuration files" restore_directory_from_usb /root/tempconfig config - cp -f /root/tempconfig/root/${PROJECT_NAME}.cfg /homeroot/${PROJECT_NAME}.cfg + cp -f /root/tempconfig/root/${PROJECT_NAME}.cfg $CONFIG_FILE if [ ! "$?" = "0" ]; then unmount_drive rm -rf /root/tempconfig exit 5294 fi - cp -f /root/tempconfig/root/${PROJECT_NAME}-completed.txt /root/${PROJECT_NAME}-completed.txt + cp -f /root/tempconfig/root/${PROJECT_NAME}-completed.txt $COMPLETION_FILE if [ ! "$?" = "0" ]; then unmount_drive rm -rf /root/tempconfig diff --git a/src/freedombone-restore-remote b/src/freedombone-restore-remote index 0308135d..698c5ab8 100755 --- a/src/freedombone-restore-remote +++ b/src/freedombone-restore-remote @@ -30,6 +30,7 @@ PROJECT_NAME='freedombone' COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt +CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg export TEXTDOMAIN=${PROJECT_NAME}-restore-remote export TEXTDOMAINDIR="/usr/share/locale" @@ -135,6 +136,25 @@ function restore_database_from_friend { fi } +# Restore configuration files +if [ -d $SERVER_DIRECTORY/backup/config ]; then + echo $"Restoring configuration files" + restore_directory_from_friend /root/tempconfig config + cp -f /root/tempconfig/root/${PROJECT_NAME}.cfg $CONFIG_FILE + if [ ! "$?" = "0" ]; then + unmount_drive + rm -rf /root/tempconfig + exit 5372 + fi + cp -f /root/tempconfig/root/${PROJECT_NAME}-completed.txt $COMPLETION_FILE + if [ ! "$?" = "0" ]; then + unmount_drive + rm -rf /root/tempconfig + exit 7252 + fi + rm -rf /root/tempconfig +fi + # Restore MariaDB if [ -d $SERVER_DIRECTORY/backup/mariadb ]; then echo $"Restoring MariaDB settings"