diff --git a/borghelper.sh b/borghelper.sh index 7ff4c02..5a73bba 100755 --- a/borghelper.sh +++ b/borghelper.sh @@ -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 \ No newline at end of file