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

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$script_dir/lib/common.sh"

backup_dir="${BACKUP:-${1:-}}"
[[ -n "$backup_dir" ]] || backup_die "BACKUP is required."
backup_require_path "$backup_dir"
backup_require_path "$backup_dir/manifest.json"

if ! backup_verify_checksums "$backup_dir"; then
  backup_die "checksum verification failed"
fi

backup_log "Dump verification passed: $backup_dir"
