#!/usr/bin/env bash
set -Eeuo pipefail

# Required for properly running Git Annex, related issue:
# https://git-annex.branchable.com/bugs/assistant_crashes_in_TransferScanner/
export LANG=C.UTF-8
AWS_ACCESS_KEY_ID="$(cat ~/annex/secret/AWS/annex/key-id.txt)"
AWS_SECRET_ACCESS_KEY="$(cat ~/annex/secret/AWS/annex/access-key.txt)"
export AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY

cd "$(dirname "${BASH_SOURCE[0]}")"
../cron/nextcloud.sh

cd ~/annex/
git annex sync

cd "$(dirname "${BASH_SOURCE[0]}")"
../cron/nextcloud.sh
