]>
git.scottworley.com Git - annex-ec/blob - annex-ec-recover
3 # annex-ec: Use erasure codes for more efficient storage use in git-annex
4 # Copyright (C) 2026 Scott Worley
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as
8 # published by the Free Software Foundation, either version 3 of the
9 # License, or (at your option) any later version.
18 find_recovery_set_files
() {
22 while IFS
= read -r line
;do
23 if [[ "$line" == ' '* ]];then
24 recovery_set_files
+=( "${line# }" )
25 if [[ "${line# }" == "$1" ]];then
32 recovery_set_name
=$line
37 die
"Could not find a recovery set containing file $1"
41 while [[ "$1" == -- ]];do shift; done
44 if [[ -e "$target" ]];then continue; fi
46 git annex get
"$target"
48 if [[ -e "$target" ]];then continue; fi
50 find_recovery_set_files
"$target"
53 git annex get
"${recovery_set_files[@]}" ec
/"$recovery_set_name"*
56 # par2 doesn't like directory structure, so we work from a temp dir where we can flatten everything
61 for f
in "${recovery_set_files[@]}";do
62 ln -s "$srcdir"/"$f" .
64 ln -s "$srcdir"/ec
/"$recovery_set_name"* .
66 # We have to remove the broken symlinks or par2 gets confused trying to write to them
67 find -L .
-type l
-exec rm -v {} +
72 for f
in "${recovery_set_files[@]}";do
73 git annex reinject
"$flat"/"$(basename "$f")" "$f"