source_directories:
    - /remote/server/bram

repositories:
    - path: /repo/bram

encryption_passcommand: cat /keys/bram.key

umask: 22

compression: lz4
archive_name_format: '{now:%Y-%m-%d}'
unknown_unencrypted_repo_access_is_ok: true
relocated_repo_access_is_ok: true

keep_daily: 7
keep_weekly: 4
keep_monthly: 6

checks:
    - name: repository
    - name: archives
check_last: 3

commands:
  - before: action
    when:
      - create
    run:
      - |
        set -euo pipefail
        REMOTE=/remote/server/bram
        echo "Mounting $REMOTE..."
        mkdir -p "$REMOTE"
        sshfs user@bram.veenboer.xyz:/media/helios/Bram "$REMOTE"

  - after: action
    when:
      - create
    run:
      - |
        set -eu
        REMOTE=/remote/server/bram
        echo "Unmounting $REMOTE..."
        if mountpoint -q "$REMOTE"; then
          if command -v fusermount >/dev/null 2>&1; then
            fusermount -u "$REMOTE"
          else
            umount "$REMOTE"
          fi
        else
          echo "$REMOTE is not a mountpoint, nothing to unmount."
        fi
