fix option string spacing issues, unquote them!

This commit is contained in:
Asif Bacchus 2020-03-26 05:37:03 -06:00
parent 91359306aa
commit bcb6c9c5ef
2 changed files with 15 additions and 7 deletions

View File

@ -4,15 +4,15 @@
"fsPath": "$ROOTPATH$/borghelper.sh", "fsPath": "$ROOTPATH$/borghelper.sh",
"bookmarks": [ "bookmarks": [
-1, -1,
253, 261,
151, 159,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
-1, -1,
84 92
] ]
} }
] ]

View File

@ -69,6 +69,14 @@ while [ $# -gt 0 ]; do
archiveName="$2" archiveName="$2"
shift shift
;; ;;
--exclude)
# exclude files from restore
if [ -z "$2" ]; then
consoleError 1 "Please provide a list of exclusions in the proper borg format."
fi
exclusions="$2"
shift
;;
-f|--file) -f|--file)
# specific file to restore # specific file to restore
if [ -z "$2" ]; then if [ -z "$2" ]; then
@ -173,8 +181,8 @@ if [ "$fileName" ] && [ -z "$archiveName" ]; then
fi fi
# clean-up leading spaces in option strings # clean-up leading spaces in option strings
commonOptions=${commonOptions##[[:space:]]} if [ "$commonOptions" ]; then commonOptions=${commonOptions##[[:space:]]}; fi
restoreOptions=${restoreOptions##[[:space:]]} if [ "$restoreOptions" ]; then restoreOptions=${restoreOptions##[[:space:]]}; fi
### read borg information file ### read borg information file
@ -256,11 +264,11 @@ elif [ "$operation" = 'restore' ]; then
if [ -z "$fileName" ]; then if [ -z "$fileName" ]; then
# restore entire archive # restore entire archive
cd "$restorePath" || consoleError 4 'Could not change to restore directory.' cd "$restorePath" || consoleError 4 'Could not change to restore directory.'
borg --show-rc "$commonOptions" extract "$restoreOptions" ::"${archiveName}" borg --show-rc ${commonOptions} extract ${restoreOptions} ::"${archiveName}"
elif [ "$fileName" ]; then elif [ "$fileName" ]; then
# restore single file # restore single file
cd "$restorePath" || consoleError 4 'Could not change to restore directory.' cd "$restorePath" || consoleError 4 'Could not change to restore directory.'
borg --show-rc "$commonOptions" extract "$restoreOptions" ::"${archiveName}" "${fileName}" borg --show-rc ${commonOptions} extract ${restoreOptions} ::"${archiveName}" "${fileName}"
fi fi
fi fi