#!/usr/bin/env bash # annex-ec: Use erasure codes for more efficient storage use in git-annex # Copyright (C) 2026 Scott Worley # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. set -euo pipefail die() { echo "$*" >&2 exit 1 } check_one_group() { local where_data where_data=$(set +e; git annex whereis --json "${recovery_set_files[@]}"; set -e) missing_data=$(jq -r 'if .whereis == [] then .file else empty end' <<< "$where_data") if [[ "$missing_data" ]];then xargs -d \\n annex-ec-recover <<< "$missing_data" fi } check_all_groups() { recovery_set_name= recovery_set_files=() while IFS= read -r line;do if [[ "$line" == ' '* ]];then recovery_set_files+=( "${line# }" ) else if [[ "$recovery_set_name" ]];then check_one_group fi recovery_set_name=$line recovery_set_files=() fi done < ec/.meta check_one_group } check_all_groups