derive restorePath abs path
Fixes the touch.test removal error and is more robust in commands.
This commit is contained in:
		
							parent
							
								
									37bd4e69c6
								
							
						
					
					
						commit
						29ab2c11a3
					
				| @ -274,6 +274,12 @@ if [ "$restoreOptions" ]; then restoreOptions=${restoreOptions##[[:space:]]}; fi | ||||
| # check/create restore path | ||||
| if [ "$operation" = 'restore' ]; then | ||||
|     if [ -d "$restorePath" ]; then | ||||
|         # convert to absolute path | ||||
|         restorePath=$( | ||||
|             cd "$restorePath" || \ | ||||
|             consoleError 5 'Cannot access specified restore directory.'; \ | ||||
|             pwd -P | ||||
|         ) | ||||
|         if ! touch "${restorePath}/touch.test" > /dev/null 2>&1; then | ||||
|             consoleError 5 'Cannot write to specified restore directory.' | ||||
|         fi | ||||
| @ -281,6 +287,12 @@ if [ "$operation" = 'restore' ]; then | ||||
|         if ! mkdir -p "${restorePath}" > /dev/null 2>&1; then | ||||
|             consoleError 5 'Cannot create specified restore directory.' | ||||
|         else | ||||
|             # convert to absolute path | ||||
|             restorePath=$( | ||||
|                 cd "$restorePath" || \ | ||||
|                 consoleError 5 'Cannot access specified restore directory.'; \ | ||||
|                 pwd -P | ||||
|             ) | ||||
|             if ! touch "${restorePath}/touch.test" > /dev/null 2>&1; then | ||||
|             consoleError 5 'Cannot write to specified restore directory.' | ||||
|             fi | ||||
| @ -398,6 +410,6 @@ exit 0 | ||||
| # 2:    parameter missing/invalid in .borgvars file | ||||
| # 3:    could not create/remove borg tmp directory | ||||
| # 4:    could not write sample borgvars file (permissions?) | ||||
| # 5:    cannot create/write to restore path or could not remove touch.test file | ||||
| # 5:    cannot access/create/write to restore path or could not remove test file | ||||
| 
 | ||||
| #EOF | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user