only create restorePath if operation is 'restore'

This commit is contained in:
Asif Bacchus 2020-03-26 08:06:01 -06:00
parent f18de4f411
commit d29dec95e2

View File

@ -272,11 +272,12 @@ if [ "$commonOptions" ]; then commonOptions=${commonOptions##[[:space:]]}; fi
if [ "$restoreOptions" ]; then restoreOptions=${restoreOptions##[[:space:]]}; fi
# check/create restore path
if [ -d "$restorePath" ]; then
if [ "$operation" = 'restore' ]; then
if [ -d "$restorePath" ]; then
if ! touch "${restorePath}/touch.test" > /dev/null 2>&1; then
consoleError 5 'Cannot write to specified restore directory.'
fi
else
else
if ! mkdir -p "${restorePath}" > /dev/null 2>&1; then
consoleError 5 'Cannot create specified restore directory.'
else
@ -284,9 +285,9 @@ else
consoleError 5 'Cannot write to specified restore directory.'
fi
fi
fi
fi
### read borg information file
# check if file was provided as a relative or absolute path