diff options
Diffstat (limited to 'scripts/main.sh')
-rwxr-xr-x | scripts/main.sh | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/scripts/main.sh b/scripts/main.sh index 1b1a12f..08d747b 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -1,20 +1,35 @@ #!/bin/bash -set -ex +set -e +b=../scratch/dump-zero +gen() ( + local tgt=$1; shift + local log=${tgt%.*}.log + if test -s "$tgt"; then + return + fi + set -x + time "$@" \ + >"$tgt" \ + 2> >(tee >&2 "$log") +) + +set -x go build ./cmd/btrfs-rec -if ! test -s ../scratch/dump-zero.scan-for-nodes.json; then - time ./btrfs-rec --pv=../scratch/dump-zero.img inspect scan-for-nodes > ../scratch/dump-zero.scan-for-nodes.json -fi -if ! test -s ../scratch/dump-zero.mappings.0.json; then - time ./btrfs-rec --pv=../scratch/dump-zero.img inspect rebuild-mappings ../scratch/dump-zero.scan-for-nodes.json \ - > ../scratch/dump-zero.mappings.0.json \ - 2> >(tee >&2 ../scratch/dump-zero.mappings.0.log) -fi -if ! test -s ../scratch/dump-zero.mappings.1.json; then - time ./btrfs-rec --pv=../scratch/dump-zero.img --mappings=../scratch/dump-zero.mappings.0.json inspect scan-for-extents ../scratch/dump-zero.scan-for-nodes.json \ - > ../scratch/dump-zero.mappings.1.json \ - 2> >(tee >&2 ../scratch/dump-zero.mappings.1.log) -fi +mkdir -p "$b.gen" +{ set +x; } &>/dev/null +gen $b.gen/0.scan-for-nodes.json \ + ./btrfs-rec --pv=$b.img \ + inspect scan-for-nodes +gen $b.gen/1.mappings.json \ + ./btrfs-rec --pv=$b.img \ + inspect rebuild-mappings $b.gen/0.scan-for-nodes.json +gen $b.gen/2.csums.gob \ + ./btrfs-rec --pv=$b.img --mappings=$b.gen/1.mappings.json \ + inspect dump-sums +gen $b.gen/3.mappings.json \ + ./btrfs-rec --pv=$b.img --mappings=$b.gen/1.mappings.json \ + inspect scan-for-extents $b.gen/0.scan-for-nodes.json $b.gen/2.csums.gob -#time ./btrfs-rec --pv=../scratch/dump-zero.img --mappings=../scratch/dump-zero.mappings.0.json inspect ls-files \ -# &> ../scratch/dump-zero.ls-files.txt +#time ./btrfs-rec --pv=$b.img --mappings=$b.mappings.0.json inspect ls-files \ +# &> $b.ls-files.txt |