fix option string spacing issues, unquote them!
This commit is contained in:
parent
91359306aa
commit
bcb6c9c5ef
6
.vscode/numbered-bookmarks.json
vendored
6
.vscode/numbered-bookmarks.json
vendored
@ -4,15 +4,15 @@
|
||||
"fsPath": "$ROOTPATH$/borghelper.sh",
|
||||
"bookmarks": [
|
||||
-1,
|
||||
253,
|
||||
151,
|
||||
261,
|
||||
159,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
84
|
||||
92
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -69,6 +69,14 @@ while [ $# -gt 0 ]; do
|
||||
archiveName="$2"
|
||||
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)
|
||||
# specific file to restore
|
||||
if [ -z "$2" ]; then
|
||||
@ -173,8 +181,8 @@ if [ "$fileName" ] && [ -z "$archiveName" ]; then
|
||||
fi
|
||||
|
||||
# clean-up leading spaces in option strings
|
||||
commonOptions=${commonOptions##[[:space:]]}
|
||||
restoreOptions=${restoreOptions##[[:space:]]}
|
||||
if [ "$commonOptions" ]; then commonOptions=${commonOptions##[[:space:]]}; fi
|
||||
if [ "$restoreOptions" ]; then restoreOptions=${restoreOptions##[[:space:]]}; fi
|
||||
|
||||
|
||||
### read borg information file
|
||||
@ -256,11 +264,11 @@ elif [ "$operation" = 'restore' ]; then
|
||||
if [ -z "$fileName" ]; then
|
||||
# restore entire archive
|
||||
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
|
||||
# restore single file
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user