]> arthur.barton.de Git - bup.git/commitdiff
t/compare-trees: check rsync capability support correctly.
authorRob Browning <rlb@defaultvalue.org>
Sun, 4 Aug 2013 18:39:55 +0000 (13:39 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 10 Aug 2013 16:12:48 +0000 (11:12 -0500)
Handle older versions of rsync (where nothing was printed), and for
newer versions, check for "no FOO" rather than "FOO", since FOO will
always be listed one way or the other.

Handle ACL and xattr support independently.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Zoran Zaric <zz@zoranzaric.de>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
t/compare-trees

index b611b0f489402e4b56d1652661ffb75b3b0a5640..2568f5fa698ccf824c1ce96ca3f86c34f9f65fee 100755 (executable)
@@ -47,18 +47,24 @@ trap "rm -rf '${tmpfile}'" EXIT
 
 rsync_opts="-niaH$verify_content --delete"
 
-if rsync --version | grep -q xattrs; then
+rsync_version=$(rsync --version)
+if [[ ! "$rsync_version" =~ "ACLs" ]] || [[ "$rsync_version" =~ "no ACLs" ]]; then
+    echo "Not comparing ACLs (not supported by available rsync)" 1>&2
+else
     case $OSTYPE in
         cygwin|darwin)
-            # bup doesn't support ACLs here yet.
-            rsync_opts="$rsync_opts -X"
+            echo "Not comparing ACLs (not yet supported on $OSTYPE)" 1>&2
             ;;
         *)
-            rsync_opts="$rsync_opts -AX"
+            rsync_opts="$rsync_opts -A"
             ;;
     esac
+fi
+
+if [[ ! "$rsync_version" =~ "xattrs" ]] || [[ "$rsync_version" =~ "no xattrs" ]]; then
+    echo "Not comparing xattrs (not supported by available rsync)" 1>&2
 else
-    echo "Not comparing xattrs/acls (unsupported by available rsync)." 1>&2
+    rsync_opts="$rsync_opts -X"
 fi
 
 rsync $rsync_opts "$src" "$dest" > "${tmpfile}"