Hopefully I will never need to look at this again, but I went through a lot of trouble making it work, so here it is.
#!/bin/bash
SB="/path/to/your/Backup.sparsebundle"
TM_MNT="/path/to/where/to/mount"
# Make directories
mkdir -p "$TM_MNT"
SB_MNT=`mktemp --tmpdir -d sparsebundle_mnt.XXX`
SB_DMG="$SB_MNT/sparsebundle.dmg"
HFS_MNT=`mktemp --tmpdir -d hfsx_mnt.XXX`
# Mount the sparse bundle
sudo `which sparsebundlefs` "$SB" "$SB_MNT"
# Mount the HFS+ partition
OFF=`sudo parted "$SB_DMG" unit B print | tr 'B' ' ' | awk '/hfsx/ {print $2}'`
SZ=`sudo parted "$SB_DMG" unit B print | tr 'B' ' ' | awk '/hfsx/ {print $4}'`
LO=`sudo losetup -f "$SB_DMG" --offset $OFF --sizelimit $SZ --show`
sudo mount -t hfsplus -r "$LO" "$HFS_MNT"
# Mount the Time Machine filesystem
sudo `which tmfs` "$HFS_MNT" "$TM_MNT" -ouid=$(id -u $USER),gid=$(id -g $USER),allow_other
rsync had problems with the hard links, and often would get caught in weird backup loops and try and backup the same sets of files over and over. Good 'ol cp -R gave me no such problems.sudo umount "$TM_MNT" sudo rmdir "$TM_MNT" sudo umount "$HFS_MNT" sudo rmdir "$HFS_MNT" sudo losetup -d "$LO" sudo umount "$SB_MNT" sudo rmdir "$SB_MNT"
Time Machine may be fine for one-off file recovery on a working system, but it SUCKS as an archival method. Don't do it.