diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-05-23 12:44:36 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-05-23 12:44:36 -0300 |
commit | cc6feac775f15a091800a36a131d90fcaa25713d (patch) | |
tree | 0093c4aa378b7e994b0220103010efea8f038dd3 /borger | |
parent | 1139766b616a057f884397b85997c31a03c24bec (diff) | |
download | borger-cc6feac775f15a091800a36a131d90fcaa25713d.tar.gz borger-cc6feac775f15a091800a36a131d90fcaa25713d.tar.bz2 |
Support for local backups
Diffstat (limited to 'borger')
-rwxr-xr-x | borger | 27 |
1 files changed, 21 insertions, 6 deletions
@@ -88,14 +88,29 @@ function borger_trap { # Initialize function borger_init { - if ! ssh $SSH_SERVER -p $SSH_PORT test -f $BORG_REPO_DIR/config; then - info "Initializing borg repository at $BORG_REPO..." - borg init --encryption=$encryption $BORG_REPO + if [ ! -z "$SSH_SERVER" ]; then + # Remote backup over SSH + if ! ssh $SSH_SERVER -p $SSH_PORT test -f $BORG_REPO_DIR/config; then + info "Initializing borg repository at $BORG_REPO..." + borg init --encryption=$encryption $BORG_REPO - init_exit=$? + init_exit=$? - if [ "$init_exit" != "0" ]; then - fatal "Error initializing repository" + if [ "$init_exit" != "0" ]; then + fatal "Error initializing repository" + fi + fi + else + # Local backup + if [ ! -f "$BORG_REPO/config" ]; then + info "Initializing borg repository at $BORG_REPO..." + borg init --encryption=$encryption $BORG_REPO + + init_exit=$? + + if [ "$init_exit" != "0" ]; then + fatal "Error initializing repository" + fi fi fi } |