|  | @@ -13,7 +13,7 @@
 | 
	
		
			
			| 13 | 13 |  # License
 | 
	
		
			
			| 14 | 14 |  # =======
 | 
	
		
			
			| 15 | 15 |  #
 | 
	
		
			
			| 16 |  | -# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
 | 
	
		
			
			|  | 16 | +# Copyright (C) 2014-2018 Bob Mottram <bob@freedombone.net>
 | 
	
		
			
			| 17 | 17 |  #
 | 
	
		
			
			| 18 | 18 |  # This program is free software: you can redistribute it and/or modify
 | 
	
		
			
			| 19 | 19 |  # it under the terms of the GNU Affero General Public License as published by
 | 
	
	
		
			
			|  | @@ -318,14 +318,6 @@ function restore_local_syncthing {
 | 
	
		
			
			| 318 | 318 |              mkdir -p $SYNCTHING_SHARED_DATA
 | 
	
		
			
			| 319 | 319 |          fi
 | 
	
		
			
			| 320 | 320 |          cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
 | 
	
		
			
			| 321 |  | -
 | 
	
		
			
			| 322 |  | -        if [ ! "$?" = "0" ]; then
 | 
	
		
			
			| 323 |  | -            set_user_permissions
 | 
	
		
			
			| 324 |  | -            backup_unmount_drive
 | 
	
		
			
			| 325 |  | -            systemctl start syncthing
 | 
	
		
			
			| 326 |  | -            systemctl start cron
 | 
	
		
			
			| 327 |  | -            exit 37904
 | 
	
		
			
			| 328 |  | -        fi
 | 
	
		
			
			| 329 | 321 |          rm -rf ${temp_restore_dir}shared
 | 
	
		
			
			| 330 | 322 |      fi
 | 
	
		
			
			| 331 | 323 |  
 | 
	
	
		
			
			|  | @@ -341,6 +333,9 @@ function restore_local_syncthing {
 | 
	
		
			
			| 341 | 333 |                  if [ -d ${temp_restore_dir}/home/$USERNAME/Sync ]; then
 | 
	
		
			
			| 342 | 334 |                      cp -r ${temp_restore_dir}/home/$USERNAME/Sync /home/$USERNAME/
 | 
	
		
			
			| 343 | 335 |                  else
 | 
	
		
			
			|  | 336 | +                    if [ ! -d /home/$USERNAME/Sync ]; then
 | 
	
		
			
			|  | 337 | +                        mkdir /home/$USERNAME/Sync
 | 
	
		
			
			|  | 338 | +                    fi
 | 
	
		
			
			| 344 | 339 |                      cp -r ${temp_restore_dir}/* /home/$USERNAME/Sync/
 | 
	
		
			
			| 345 | 340 |                  fi
 | 
	
		
			
			| 346 | 341 |                  if [ ! "$?" = "0" ]; then
 | 
	
	
		
			
			|  | @@ -425,7 +420,7 @@ function restore_remote_syncthing {
 | 
	
		
			
			| 425 | 420 |          if [ ! -d $SYNCTHING_CONFIG_PATH ]; then
 | 
	
		
			
			| 426 | 421 |              mkdir -p $SYNCTHING_CONFIG_PATH
 | 
	
		
			
			| 427 | 422 |          fi
 | 
	
		
			
			| 428 |  | -        cp -r ${temp_restore_dir}config/* $SYNCTHING_CONFIG_PATH/
 | 
	
		
			
			|  | 423 | +        cp -r ${temp_restore_dir}/* $SYNCTHING_CONFIG_PATH/
 | 
	
		
			
			| 429 | 424 |          if [ ! "$?" = "0" ]; then
 | 
	
		
			
			| 430 | 425 |              systemctl start syncthing
 | 
	
		
			
			| 431 | 426 |              systemctl start cron
 | 
	
	
		
			
			|  | @@ -439,17 +434,11 @@ function restore_remote_syncthing {
 | 
	
		
			
			| 439 | 434 |          temp_restore_dir=/root/tempsyncthingshared
 | 
	
		
			
			| 440 | 435 |          function_check restore_directory_from_friend
 | 
	
		
			
			| 441 | 436 |          restore_directory_from_friend $temp_restore_dir syncthingshared
 | 
	
		
			
			| 442 |  | -        #cp -r $temp_restore_dir/* /
 | 
	
		
			
			| 443 | 437 |          if [ ! -d $SYNCTHING_SHARED_DATA ]; then
 | 
	
		
			
			| 444 | 438 |              mkdir -p $SYNCTHING_SHARED_DATA
 | 
	
		
			
			| 445 | 439 |          fi
 | 
	
		
			
			| 446 |  | -        cp -r ${temp_restore_dir}shared/* $SYNCTHING_SHARED_DATA/
 | 
	
		
			
			| 447 |  | -        if [ ! "$?" = "0" ]; then
 | 
	
		
			
			| 448 |  | -            systemctl start syncthing
 | 
	
		
			
			| 449 |  | -            systemctl start cron
 | 
	
		
			
			| 450 |  | -            exit 37904
 | 
	
		
			
			| 451 |  | -        fi
 | 
	
		
			
			| 452 |  | -        rm -rf $temp_restore_dir
 | 
	
		
			
			|  | 440 | +        cp -r ${temp_restore_dir}/* $SYNCTHING_SHARED_DATA/
 | 
	
		
			
			|  | 441 | +        rm -rf ${temp_restore_dir}
 | 
	
		
			
			| 453 | 442 |      fi
 | 
	
		
			
			| 454 | 443 |  
 | 
	
		
			
			| 455 | 444 |      if [ -d $SERVER_DIRECTORY/backup/syncthing ]; then
 | 
	
	
		
			
			|  | @@ -466,6 +455,9 @@ function restore_remote_syncthing {
 | 
	
		
			
			| 466 | 455 |                  if [ -d $temp_restore_dir/home/$USERNAME/Sync ]; then
 | 
	
		
			
			| 467 | 456 |                      cp -r $temp_restore_dir/home/$USERNAME/Sync /home/$USERNAME/
 | 
	
		
			
			| 468 | 457 |                  else
 | 
	
		
			
			|  | 458 | +                    if [ ! -d /home/$USERNAME/Sync ]; then
 | 
	
		
			
			|  | 459 | +                        mkdir /home/$USERNAME/Sync
 | 
	
		
			
			|  | 460 | +                    fi
 | 
	
		
			
			| 469 | 461 |                      cp -r $temp_restore_dir/* /home/$USERNAME/Sync/
 | 
	
		
			
			| 470 | 462 |                  fi
 | 
	
		
			
			| 471 | 463 |                  if [ ! "$?" = "0" ]; then
 |