Permalink
Browse files

bin: update backup script

Remove the ambiguity of some rsync options. OS X 10.6 and up ship with a
version of rsync that defined `-E` as `--extended-attributes` when it's
normally `--executability`. To avoid this confusion,
`--extended-attributes` is used explicitly.

Move the excludes file out of `bin/` as it doesn't belong with scripts
  • Loading branch information...
necolas committed Aug 5, 2012
1 parent de02be1 commit 12fc71c78e5ace136072a3cccd9598aaae0522d3
Showing with 10 additions and 9 deletions.
  1. 0 {bin → }/backup_excludes.txt
  2. +10 −9 bin/{backup.sh → backup}
File renamed without changes.
@@ -7,30 +7,31 @@ PROG=$0
RSYNC="/usr/bin/rsync"
SRC="/"
DST="/Volumes/Macintosh HD/"
-EXCLUDE="$HOME/.dotfiles/bin/backup_excludes.txt"
+EXCLUDE="$HOME/.dotfiles/backup_excludes.txt"
# -v increase verbosity
# -a turns on archive mode (recursive copy + retain attributes)
# -x don't cross device boundaries (ignore mounted volumes)
-# -E preserve executability
-# -S handle spare files efficiently
+# -S handles spare files efficiently
+# -H preserves hard-links
+# --extended-attributes preserves ACLs and Resource Forks
# --delete deletes any files that have been deleted locally
+# --delete-excluded deletes any files (on DST) that are part of the list of excluded files
# --exclude-from reference a list of files to exclude
-# --delete-excluded
if [ ! -r "$SRC" ]; then
- /usr/bin/logger -t $PROG "Source $SRC not readable - Cannot start the sync process"
- exit;
+ /usr/bin/logger -t $PROG "Source $SRC not readable - Cannot start the sync process"
+ exit;
fi
if [ ! -w "$DST" ]; then
- /usr/bin/logger -t $PROG "Destination $DST not writeable - Cannot start the sync process"
- exit;
+ /usr/bin/logger -t $PROG "Destination $DST not writeable - Cannot start the sync process"
+ exit;
fi
/usr/bin/logger -t $PROG "Start rsync"
-sudo $RSYNC -vaxE -S --delete --delete-excluded --exclude-from=$EXCLUDE "$SRC" "$DST"
+sudo $RSYNC -vax -S -H --extended-attributes --delete --delete-excluded --exclude-from=$EXCLUDE "$SRC" "$DST"
/usr/bin/logger -t $PROG "End rsync"

0 comments on commit 12fc71c

Please sign in to comment.