summaryrefslogtreecommitdiff
path: root/scripts/main.sh
blob: bc8b01d2b11b301b3e11b72ff72f1b584a6e61a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
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
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.dbg.txt \
#     ./btrfs-rec --pv=$b.img --mappings=$b.gen/1.mappings.json \
#     inspect dbg $b.gen/2.csums.gob
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=$b.img --mappings=$b.mappings.0.json inspect ls-files \
#     &> $b.ls-files.txt