7 Usage: sync-tree [-h] [-c] [-x] SOURCE/ DEST/
8 Make the DEST tree match SOURCE as closely as possible
15 while getopts "h" OPTION
19 ?) usage 1>&2; exit 1;;
23 shift $(($OPTIND - 1)) || exit $?
34 rsync_opts="-aH --delete"
36 rsync_version=$(rsync --version)
37 if [[ ! "$rsync_version" =~ "ACLs" ]] || [[ "$rsync_version" =~ "no ACLs" ]]; then
38 echo "Not syncing ACLs (not supported by available rsync)" 1>&2
42 echo "Not syncing ACLs (not yet supported on $OSTYPE)" 1>&2
45 rsync_opts="$rsync_opts -A"
51 if [[ ! "$rsync_version" =~ "xattrs" ]] || [[ "$rsync_version" =~ "no xattrs" ]]; then
52 echo "Not syncing xattrs (not supported by available rsync)" 1>&2
58 # rsync may fail if -X is specified and the filesystems don't support
61 if test "$xattrs_available"; then
62 rsync $rsync_opts -X "$src" "$dest"
63 if test $? -ne 0; then
64 # Try again without -X
65 exec rsync $rsync_opts "$src" "$dest"
68 exec rsync $rsync_opts "$src" "$dest"