# Test that src and dest trees are as identical as bup is capable of
# making them. For now, use rsync -niaHAX ...
-set -e
-set -o pipefail
-
usage() {
cat <<EOF
Usage: compare-trees [-h] [-c] [-x] SOURCE DEST
esac
done
-shift $(($OPTIND - 1))
+shift $(($OPTIND - 1)) || exit $?
if ! test $# -eq 2
then
src="$1"
dest="$2"
-tmpfile="$(mktemp /tmp/bup-test-XXXXXXX)"
-trap "rm -rf '${tmpfile}'" EXIT
+tmpfile="$(mktemp /tmp/bup-test-XXXXXXX)" || exit $?
+trap "rm -rf '$tmpfile'" EXIT || exit $?
rsync_opts="-niaH$verify_content --delete"
echo "Not comparing ACLs (not supported by available rsync)" 1>&2
else
case $OSTYPE in
- cygwin|darwin)
+ cygwin|darwin|netbsd)
echo "Not comparing ACLs (not yet supported on $OSTYPE)" 1>&2
;;
*)
rsync_opts="$rsync_opts -X"
fi
-rsync $rsync_opts "$src" "$dest" > "${tmpfile}"
+rsync $rsync_opts "$src" "$dest" > "$tmpfile" || exit $?
-if test $(wc -l < "${tmpfile}") != 0; then
+if test $(wc -l < "$tmpfile") != 0; then
echo "Differences between $src and $dest"
- cat "${tmpfile}"
+ cat "$tmpfile"
exit 1
fi