From 9ef05505a62eaf783995ae6382262ae6fd1e4786 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Thu, 26 Mar 2020 05:49:23 -0600 Subject: [PATCH] make sample borgvars file --- .vscode/numbered-bookmarks.json | 6 +++--- borghelper.sh | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index b575bcb..a33e492 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -4,15 +4,15 @@ "fsPath": "$ROOTPATH$/borghelper.sh", "bookmarks": [ -1, - 261, - 159, + 151, + 168, -1, -1, -1, -1, -1, -1, - 92 + 105 ] } ] diff --git a/borghelper.sh b/borghelper.sh index 9e54172..23755e9 100755 --- a/borghelper.sh +++ b/borghelper.sh @@ -103,6 +103,10 @@ while [ $# -gt 0 ]; do # list all backup archives operation='listall' ;; + --makevars) + # make a borgvars template file + operation='makevars' + ;; -p|--path) # path to restore files if [ -z "$2" ]; then @@ -145,6 +149,15 @@ while [ $# -gt 0 ]; do done +### process 'makevars' operation +if [ "$operation" = 'makevars' ]; then + if ! printf "sshKeyFile=\nborgBaseDir=\nborgRepo=\nborgRepoPassword=\nborgRemote=\n" > ./sample.borgvars; then + consoleError 4 'Could not write sample borgvars file.' + else + exit 0 + fi +fi + ### check parameter validity # no operation