-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathcreate-example.sh
More file actions
executable file
·59 lines (48 loc) · 1.3 KB
/
Copy pathcreate-example.sh
File metadata and controls
executable file
·59 lines (48 loc) · 1.3 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Note: Use '--inspect' parameter to prevent cleaning up for further inspections.
set -u
test_sub="./btrfs-diff-tests"
old="${test_sub}.parent"
new="${test_sub}.child"
clean_up(){
echo "Cleaning up temporary subvolumes."
for sub in $test_sub $old $new; do
[[ -d $sub ]] && sudo btrfs sub del -c $sub > /dev/null
done
}
die(){
echo "ERROR: $@"
exit 1
}
clean_up
btrfs subvolume create $test_sub
btrfs filesystem sync $test_sub
btrfs subvolume snap -r $test_sub $old
sleep 1
btrfs filesystem sync $old
cd $test_sub
touch file
mkdir dir
mkfifo fifo
ln file hardlink
ln -s file symlink
echo 'Hello Btrfs' > 'xxx;yyy;zzz'
mv file file2
cd ..
btrfs filesystem sync $test_sub
btrfs subvolume snap -r $test_sub $new
btrfs filesystem sync $new
dir=$(pwd)
echo 'btrfs-snapshots-diff.py group by path output:'
echo '============================================='
sudo $dir/btrfs-snapshots-diff.py -p $old -c $new --by_path --bogus --filter
echo
echo 'btrfs-snapshots-diff.py CSV output:'
echo '==================================='
sudo $dir/btrfs-snapshots-diff.py -p $old -c $new --csv
echo
echo 'btrfs-snapshots-diff.py JSON output:'
echo '===================================='
sudo $dir/btrfs-snapshots-diff.py -p $old -c $new --json --pretty
echo
[[ "${1:-}" == "--inspect" ]] || clean_up