summaryrefslogtreecommitdiff
path: root/examples/diff-dump-tree.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-05-06 17:54:46 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2023-05-06 17:54:46 -0600
commit8dd4dfc841de65af95b716515cbfe55b3630a390 (patch)
tree5f06743a987bb8bca832d9174c163381565c5997 /examples/diff-dump-tree.sh
parenta029039acf979ec19a4a889bc73e1574f31bb65b (diff)
mv scripts examples
Diffstat (limited to 'examples/diff-dump-tree.sh')
-rwxr-xr-xexamples/diff-dump-tree.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/diff-dump-tree.sh b/examples/diff-dump-tree.sh
new file mode 100755
index 0000000..c3de337
--- /dev/null
+++ b/examples/diff-dump-tree.sh
@@ -0,0 +1,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' \
+ )