add restore operation
This commit is contained in:
parent
07fdd04754
commit
f80a66439c
2
.vscode/numbered-bookmarks.json
vendored
2
.vscode/numbered-bookmarks.json
vendored
@ -4,7 +4,7 @@
|
||||
"fsPath": "$ROOTPATH$/borghelper.sh",
|
||||
"bookmarks": [
|
||||
-1,
|
||||
222,
|
||||
231,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
|
@ -49,9 +49,9 @@ fi
|
||||
### pre-requisites
|
||||
|
||||
# is user root?
|
||||
if [ ! "$( id -u )" -eq 0 ]; then
|
||||
consoleError 1 'You must be root to run this script.'
|
||||
fi
|
||||
#if [ ! "$( id -u )" -eq 0 ]; then
|
||||
# consoleError 1 'You must be root to run this script.'
|
||||
#fi
|
||||
|
||||
# has a parameter been passed to this script?
|
||||
if [ -z "$1" ]; then
|
||||
@ -229,6 +229,19 @@ elif [ "$operation" = 'viewarchive' ]; then
|
||||
borg list ::"${archiveName}"
|
||||
fi
|
||||
|
||||
# restore operations
|
||||
if [ "$operation" = 'restore' ]; then
|
||||
if [ -z "$fileName" ]; then
|
||||
# restore entire archive
|
||||
cd "$restorePath" || consoleError 4 'Could not change to restore directory.'
|
||||
borg --show-rc extract --list ::"${archiveName}"
|
||||
elif [ "$fileName" ]; then
|
||||
# restore single file
|
||||
cd "$restorePath" || consoleError 4 'Could not change to restore directory.'
|
||||
borg --show-rc extract --list ::"${archiveName}" "${fileName}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
### exit gracefully
|
||||
cleanup
|
||||
|
Loading…
Reference in New Issue
Block a user