#!/usr/bin/env bash # Run a light restic integrity check on the given repo. # Usage: restic-check.sh nas|b2 set -uo pipefail LABEL="${1:-}" if [ "$LABEL" != "nas" ] && [ "$LABEL" != "b2" ]; then echo "label must be nas or b2" >&2 exit 2 fi if [ -z "${RESTIC_REPO_NAS:-}" ] && [ -r /etc/restic-backup.env ]; then set -a; . /etc/restic-backup.env; set +a fi case "$LABEL" in nas) REPO="${RESTIC_REPO_NAS:?RESTIC_REPO_NAS not set}" ;; b2) REPO="${RESTIC_REPO_B2:?RESTIC_REPO_B2 not set}" ;; esac export RESTIC_PASSWORD_FILE="${RESTIC_PASSWORD_FILE:-/etc/restic-backup.password}" restic -r "$REPO" check