diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index 0d40fce..ce82f5a 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -4,7 +4,7 @@ "fsPath": "$ROOTPATH$/borghelper.sh", "bookmarks": [ -1, - 222, + 231, -1, -1, -1, diff --git a/borghelper.sh b/borghelper.sh index 8c170ad..fbbcca0 100755 --- a/borghelper.sh +++ b/borghelper.sh @@ -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