Sometimes there is no shared data to restore

This commit is contained in:
Bob Mottram 2018-01-20 10:21:38 +00:00
parent 4bfd152772
commit 7ab85b55d2
1 changed files with 10 additions and 18 deletions

View File

@ -13,7 +13,7 @@
# License
# =======
#
# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
# Copyright (C) 2014-2018 Bob Mottram <bob@freedombone.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -318,14 +318,6 @@ function restore_local_syncthing {
mkdir -p $SYNCTHING_SHARED_DATA
fi
cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
if [ ! "$?" = "0" ]; then
set_user_permissions
backup_unmount_drive
systemctl start syncthing
systemctl start cron
exit 37904
fi
rm -rf ${temp_restore_dir}shared
fi
@ -341,6 +333,9 @@ function restore_local_syncthing {
if [ -d ${temp_restore_dir}/home/$USERNAME/Sync ]; then
cp -r ${temp_restore_dir}/home/$USERNAME/Sync /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/Sync ]; then
mkdir /home/$USERNAME/Sync
fi
cp -r ${temp_restore_dir}/* /home/$USERNAME/Sync/
fi
if [ ! "$?" = "0" ]; then
@ -425,7 +420,7 @@ function restore_remote_syncthing {
if [ ! -d $SYNCTHING_CONFIG_PATH ]; then
mkdir -p $SYNCTHING_CONFIG_PATH
fi
cp -r ${temp_restore_dir}config/* $SYNCTHING_CONFIG_PATH/
cp -r ${temp_restore_dir}/* $SYNCTHING_CONFIG_PATH/
if [ ! "$?" = "0" ]; then
systemctl start syncthing
systemctl start cron
@ -439,17 +434,11 @@ function restore_remote_syncthing {
temp_restore_dir=/root/tempsyncthingshared
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir syncthingshared
#cp -r $temp_restore_dir/* /
if [ ! -d $SYNCTHING_SHARED_DATA ]; then
mkdir -p $SYNCTHING_SHARED_DATA
fi
cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
if [ ! "$?" = "0" ]; then
systemctl start syncthing
systemctl start cron
exit 37904
fi
rm -rf $temp_restore_dir
cp -r ${temp_restore_dir}/* $SYNCTHING_SHARED_DATA/
rm -rf ${temp_restore_dir}
fi
if [ -d $SERVER_DIRECTORY/backup/syncthing ]; then
@ -466,6 +455,9 @@ function restore_remote_syncthing {
if [ -d $temp_restore_dir/home/$USERNAME/Sync ]; then
cp -r $temp_restore_dir/home/$USERNAME/Sync /home/$USERNAME/
else
if [ ! -d /home/$USERNAME/Sync ]; then
mkdir /home/$USERNAME/Sync
fi
cp -r $temp_restore_dir/* /home/$USERNAME/Sync/
fi
if [ ! "$?" = "0" ]; then