#!/bin/bash # Back-up a remote HFS+ filesystem to here. status=0 hostname="$1" destination="$2" priorbackup="$3" # Step 1: Expose resource files. ssh -n "$hostname" 'resourcefork -uv -f /var/tmp/x10-resource-file-list expose "$HOME"' || status=$? # Step 2: Get the backup # There's bugs in -o and -g that cause problems with --link-dest. # It's supposed to be fixed in an upcoming rsync. rsync -rlptDv -H -z -e ssh \ --exclude Library/Caches \ --exclude Music \ --exclude "Desktop/Incoming Music" \ --exclude .Trash \ --link-dest="$priorbackup" "$hostname:." "$destination" || status=$? # Step 3: Remove the resource files ssh -n "$hostname" 'resourcefork -f /var/tmp/x10-resource-file-list hide "$HOME"' || status=$? exit $?