summaryrefslogtreecommitdiff
path: root/examples/diff-dump-tree.sh
blob: c3de33765f9921eb4954768ec9c835dd1051cb50 (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
#!/bin/bash
readonly image=../scratch/new.img

######################################################################

set -e
(
	cd ../btrfs-progs
	if ! test -f configure; then
		./autogen.sh
	fi
	if ! test -f config.status; then
		./configure \
			--disable-documentation \
			--enable-experimental
	fi
	make
)

make build

######################################################################

diff -u \
     <(../btrfs-progs/btrfs inspect dump-tree --noscan --csum-items "$image" |
	       sed -e 's/ UNKNOWN.0 / UNTYPED /g' \
		   -e 's/\b18446744073709551615\b/-1/g' \
		   -e 's/INODE_REF 6)/INODE_REF ROOT_TREE_DIR)/g' \
		   -e 's/ROOT_BACKREF 5)/ROOT_BACKREF FS_TREE)/g' \
		   ) \
     <(./bin/btrfs-rec inspect dump-trees --pv="$image" |
	       sed -E \
		   -e 's/([0-9]),/\1/g' \
		   )