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",
|
"fsPath": "$ROOTPATH$/borghelper.sh",
|
||||||
"bookmarks": [
|
"bookmarks": [
|
||||||
-1,
|
-1,
|
||||||
222,
|
231,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
-1,
|
-1,
|
||||||
|
@ -49,9 +49,9 @@ fi
|
|||||||
### pre-requisites
|
### pre-requisites
|
||||||
|
|
||||||
# is user root?
|
# is user root?
|
||||||
if [ ! "$( id -u )" -eq 0 ]; then
|
#if [ ! "$( id -u )" -eq 0 ]; then
|
||||||
consoleError 1 'You must be root to run this script.'
|
# consoleError 1 'You must be root to run this script.'
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
# has a parameter been passed to this script?
|
# has a parameter been passed to this script?
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
@ -229,6 +229,19 @@ elif [ "$operation" = 'viewarchive' ]; then
|
|||||||
borg list ::"${archiveName}"
|
borg list ::"${archiveName}"
|
||||||
fi
|
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
|
### exit gracefully
|
||||||
cleanup
|
cleanup
|
||||||
|
Loading…
Reference in New Issue
Block a user