#!/bin/sh
set -eux

# shellcheck source=/dev/null
. "${HOME}/.ssh/environment" > /dev/null
BORG_PASSPHRASE="$(cat ~/annex/secret/Borg/passphrase.txt)"
export BORG_PASSPHRASE
R='16686@ch-s010.rsync.net'
export BORG_REMOTE_PATH='borg1'

# env has BORG_PASSPHRASE='...' BORG_REMOTE_PATH='...'
# borg init -e repokey-blake2 $R:desktop-borg

borg create                                  \
     --exclude ~/mbsync/.notmuch/            \
     --exclude ~/gPodder/Downloads           \
     --verbose                               \
     --stats                                 \
     --progress                              \
     --compression lzma,6                    \
     "$R:desktop-borg::{hostname}-{now}-job" \
     ~/Sync/                                 \
     ~/BigSync/                              \
     ~/mbsync/                               \
     ~/archive/                              \
     ~/gPodder/                              \
     ~/.local/share/buku/                    \
     ~/dev/libre/website/
     # add folders to be backed up here

# borg prune --keep-last 60 --verbose "$R:desktop-borg"

cd ~/dev/libre/others/borg/
git add .
git commit -m 'JOB: automated update of borg config files after backup.sh'
git push origin master
