add progress and file-list options as switches
This commit is contained in:
parent
f80a66439c
commit
39f519a67e
2
.vscode/numbered-bookmarks.json
vendored
2
.vscode/numbered-bookmarks.json
vendored
@ -4,7 +4,7 @@
|
|||||||
"fsPath": "$ROOTPATH$/borghelper.sh",
|
"fsPath": "$ROOTPATH$/borghelper.sh",
|
||||||
"bookmarks": [
|
"bookmarks": [
|
||||||
-1,
|
-1,
|
||||||
231,
|
243,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
|
@ -99,6 +99,10 @@ while [ $# -gt 0 ]; do
|
|||||||
restorePath="${2%/}"
|
restorePath="${2%/}"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--progress)
|
||||||
|
# show progress
|
||||||
|
commonOptions="$commonOptions --progress"
|
||||||
|
;;
|
||||||
-r|--restore)
|
-r|--restore)
|
||||||
# restore archive/file
|
# restore archive/file
|
||||||
operation='restore'
|
operation='restore'
|
||||||
@ -114,6 +118,10 @@ while [ $# -gt 0 ]; do
|
|||||||
varsFile="$2"
|
varsFile="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--verbose)
|
||||||
|
# display each file being processed
|
||||||
|
restoreOptions="$restoreOptions --list"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
# invalid option
|
# invalid option
|
||||||
printf "%s\nUnknown option: %s\n" "$err" "$1"
|
printf "%s\nUnknown option: %s\n" "$err" "$1"
|
||||||
@ -155,6 +163,10 @@ if [ "$fileName" ] && [ -z "$archiveName" ]; then
|
|||||||
consoleError 1 "Filename specified without an associated archive name."
|
consoleError 1 "Filename specified without an associated archive name."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# clean-up leading spaces in option strings
|
||||||
|
commonOptions=${commonOptions##[[:space:]]}
|
||||||
|
restoreOptions=${restoreOptions##[[:space:]]}
|
||||||
|
|
||||||
|
|
||||||
### read borg information file
|
### read borg information file
|
||||||
|
|
||||||
@ -234,11 +246,11 @@ if [ "$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 extract --list ::"${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 extract --list ::"${archiveName}" "${fileName}"
|
borg --show-rc "$commonOptions" extract "$restoreOptions" ::"${archiveName}" "${fileName}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user