Short and sweet
Download my script to automate rdiff-backup installation on OS X.
Longer version with background
I use rdiff-backup to keep all my systems backed up. Rdiff-backup keeps incremental changes and permission information, and only transmits changes over the network. It’s great for automated remote backups. All my Linux systems backup at least once a night, some several times daily to offsite locations via consumer-class internet connections. The first backup is painful if you have a lot of data, but after that only differences have to go so things are pretty smooth.
I decided I want to run remote backups from my MacBook Pro even during those rare times when I’m running OS X. Time Machine doesn’t support remote destinations natively (and requires much more space because it’s not incremental). Getting rdiff-backup on OS X is a little tricky. According to rdiff-backup’s website both DarwinPorts and Fink have packages for rdiff-backup, which is fine and dandy but I have neither installed. I’d rather not add that much bulk to my system just to get rdiff-backup. I also like to match the version I’m running on my Linux systems, and DarwinPorts/Fink seem to lag behind the latest releases.
Foreseeing the need to deploy rdiff-backup on the Macs at work as well, I created the script below to automate installation of rdiff-backup from source and allow specification of a particular version. I’m releasing it as is, tested only by myself. If you find it useful or have suggestions, please let me know. (Comment below). You can download the script via the link above.
#!/bin/bash
# Rdiff-backup installation script for OS X 10.5.1
#
# Version 0.1
#
# Changelog:
# 2008/05/14 - Initial version - Aaron <aaron@xxxxxxxx>
#
# Define which versions of the software packages we want.
# Note that librsync version 0.9.7 requires a patch for 4GB+ file sizes.
RDIFF_VERSION="1.1.12"
XATTR_VERSION="0.4"
LIBRSYNC_VERSION="0.9.7"
# Define installation prefix for librsync. Python packages are installed with prefix=/
PREFIX="/usr/local"
# Exit on errors
set -o errexit
# Exit if using unset variable
set -o nounset
# Download URIs
RDIFF_URI="http://savannah.nongnu.org/download/rdiff-backup/rdiff-backup-${RDIFF_VERSION}.tar.gz"
XATTR_URI="http://pypi.python.org/packages/source/x/xattr/xattr-0.4.tar.gz"
LIBRSYNC_URI="http://downloads.sourceforge.net/librsync/librsync-${LIBRSYNC_VERSION}.tar.gz"
LIBRSYNC_PATCH_URI="https://sourceforge.net/tracker/download.php?group_id=56125&atid=479441&file_id=169866&aid=1439412"
# Download the necessary sources
curl -L -O "${RDIFF_URI}"
curl -L -O "${XATTR_URI}"
curl -L -O "${LIBRSYNC_URI}"
[[ "$LIBRSYNC_VERSION" == "0.9.7" ]] && curl --insecure -L -o librsync-4gbpatch.patch "${LIBRSYNC_PATCH_URI}"
# librsync
tar -zxvf librsync-${LIBRSYNC_VERSION}.tar.gz
cd librsync-${LIBRSYNC_VERSION}
[[ "$LIBRSYNC_VERSION" == "0.9.7" ]] && patch -i ../librsync-4gbpatch.patch
./configure --prefix="${PREFIX}"
make
sudo make install
cd ..
# xattr
tar -zxvf xattr-${XATTR_VERSION}.tar.gz
cd xattr-${XATTR_VERSION}
python setup.py build
sudo python setup.py install
cd ..
# Rdiff-backup
tar -zxvf rdiff-backup-${RDIFF_VERSION}.tar.gz
cd rdiff-backup-${RDIFF_VERSION}
python setup.py build
sudo python setup.py install
cd ..
echo -e "\n\nInstallation complete!"
echo "I've left all the temporary files in this directory in case you want to uninstsall the software later."
echo "Happy rdiff-backuping!"
Tags: bash, os x, rdiff-backup
Note to self: XCode must be installed to have a C compiler on hand.
Additional note to self: script does not honor XATTR_VERSION