3 # Test that src and dest trees are as identical as bup is capable of
4 # making them. For now, use rsync -niaHAX ...
11 Usage: compare-trees [-h] [-c] [-x] SOURCE DEST
16 Check file content (default)
18 Don't check file content (rely on size/timestamps, etc.)
22 verify_content=" --checksum"
24 while getopts "hcx" OPTION
28 c) verify_content=" --checksum";;
29 x) verify_content="";;
30 ?) usage 1>&2; exit 1;;
34 shift $(($OPTIND - 1))
45 tmpfile="$(mktemp /tmp/bup-test-XXXXXXX)"
46 trap "rm -rf '${tmpfile}'" EXIT
48 rsync_opts="-niaH$verify_content --delete"
50 if rsync --version | grep -q xattrs; then
51 if [[ $(uname) =~ CYGWIN ]]; then
52 # bup doesn't support ACLs on Cygwin yet.
53 rsync_opts="$rsync_opts -X"
55 rsync_opts="$rsync_opts -AX"
58 echo "Not comparing xattrs/acls (unsupported by available rsync)." 1>&2
61 rsync $rsync_opts "$src" "$dest" > "${tmpfile}"
63 if test $(wc -l < "${tmpfile}") != 0; then
64 echo "Differences between $src and $dest"