Remote restore of configuration files

This commit is contained in:
Bob Mottram 2015-12-09 12:31:43 +00:00
parent 4cae6b24ce
commit 5df28375eb
2 changed files with 22 additions and 2 deletions

View File

@ -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

View File

@ -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"