The -AX options won't be available if rsync doesn't report the xattr
capability, so test for that before trying to use them.
Thanks to Yung-Chin Oei <yungchin@yungchin.nl> for the suggested
approach and initial report.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
tmpfile="$(mktemp)"
trap "rm -rf '${tmpfile}'" EXIT
-rsync -niaHAX$verify_content --delete "$src" "$dest" > "${tmpfile}"
+rsync_opts="-niaH$verify_content --delete"
+
+if rsync --version | grep -q xattrs; then
+ rsync_opts="$rsync_opts -AX"
+else
+ echo "Not comparing xattrs/acls (unsupported by available rsync)." 1>&2
+fi
+
+rsync $rsync_opts "$src" "$dest" > "${tmpfile}"
+
if test $(wc -l < "${tmpfile}") != 0; then
echo "Differences between $src and $dest"
cat "${tmpfile}"