#!/bin/bash
# Copyright (C) 2018, Fork Sand, Inc.
# Copyright (C) 2017, aleph Objects, Inc.
# GPLv3
set -x

# Encryption
# export password
# restrict to certain ssh keys
# restrict ssh key commands
# Append only ?

export BORG_REPO="BACKUPS/borg/`hostname`"
export BORG_SERVER="user@host"
#export BORG_PASSPHRASE="`cat /root/.borgpw`"
export BORG_BINARY="borg1"
#export BORG_DISPLAY_PASSPHRASE=0
#export BORG_LOGGING_CONF=
export BORG_RSH="ssh -i /root/.ssh/id_ed25519-borg-`hostname`"
export BORG_REMOTE_PATH=borg1
#export BORG_FILES_CACHE_TTL=20
#export TMPDIR=
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no
export BORG_RELOCATED_REPO_ACCESS_IS_OK=no
export BORG_CHECK_I_KNOW_WHAT_I_AM_DOING=yes
export BORG_DELETE_I_KNOW_WHAT_I_AM_DOING=no
export BORG_KEYS_DIR="/root/.config/borg/keys"
export BORG_CACHE_DIR="/root/.cache/borg"

mkdir -p $BORG_KEYS_DIR
mkdir -p $BORG_CACHE_DIR

$BORG_RSH $BORG_SERVER "mkdir -p $BORG_REPO"

borg init								\
	--verbose							\
	--encryption=keyfile-blake2					\
	$BORG_SERVER:$BORG_REPO

# --append-only

