summaryrefslogtreecommitdiff
path: root/scripts/main.sh
blob: 0635e49e8087035bb4e6da84805432ddf7f3c4fe (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; command time --verbose "$@"; } \
	     >"$tgt" \
	     2> >(tee >&2 "$log")
)

set -x
go build ./cmd/btrfs-rec
mkdir -p "$b.gen"
{ set +x; } &>/dev/null

gen $b.gen/0.scandevices.json \
    ./btrfs-rec --pv=$b.img \
    inspect scandevices
gen $b.gen/1.mappings.json \
    ./btrfs-rec --pv=$b.img \
    inspect rebuild-mappings $b.gen/0.scandevices.json
gen $b.gen/2.nodes.gv-o \
    ./btrfs-rec --pv=$b.img --mappings=$b.gen/1.mappings.json \
    inspect visualize-nodes $b.gen/0.scandevices.json $b.gen/2.nodes.gv-d
# gen $b.gen/2.nodes.json \
#     ./btrfs-rec --pv=$b.img --mappings=$b.gen/1.mappings.json \
#     inspect rebuild-nodes $b.gen/0.scandevices.json

# gen $b.gen/3.ls-files.txt \
#     ./btrfs-rec --pv=$b.img --mappings=$b.gen/1.mappings.json \
#     inspect ls-files
# gen $b.gen/3.ls-trees.txt \
#     ./btrfs-rec --pv=$b.img --mappings=$b.gen/1.mappings.json \
#     inspect ls-trees