backup now does apps, breaks out aperture and dropbox

This commit is contained in:
Jeffrey Paul 2014-02-09 00:30:06 +01:00
parent 89c948ea08
commit c0021efb13
1 changed files with 32 additions and 21 deletions

View File

@ -1,36 +1,47 @@
#!/bin/bash
set -e
# mac homedir backup script.
# by jeffrey paul <sneak@datavibe.net>
# 5539 AD00 DE4C 42F3 AFE1 1575 0524 43F4 DF2A 55C2
# see README
NOW="`date +%Y%m%d.%H%M%S`"
BACKUPDEST=${BACKUPDEST:-"sftp://sneak@datavibe.net/backup"}
PASSPHRASEFILE="${HOME}/Documents/Secure/backup-password.txt"
if [ -r "$PASSPHRASEFILE" ]; then
export PASSPHRASE="$(cat $PASSPHRASEFILE)"
else
echo "$0 error: unable to read passphrase from file!" > /dev/stderr
exit 127
fi
OPTS=""
OPTS+=" -v 5"
OPTS+=" --exclude-globbing-filelist ${HOME}/.local/etc/duplicity.exclude"
OPTS+=" --volsize 100"
#OPTS+=" --asynchronous-upload"
#OPTS+=" --allow-source-mismatch"
#GPGOPTS="--compress-algo=bzip2 --bzip2-compress-level=9"
if [ "$1" == "--verify" ]; then
time \
duplicity --gpg-options '$GPGOPTS' \
verify $OPTS $BACKUPDEST ${HOME}/
else
time \
duplicity --gpg-options "$GPGOPTS" \
$EXTRADUPLICITY $OPTS $RE ${HOME}/ $BACKUPDEST
echo "attempted backup to $BACKUPDEST"
if [ $? ]; then
echo "backup failed!" > /dev/stderr
exit 127
else
echo "Successfully completed backup to ${BACKUPDEST}."
fi
fi
EXTRA=" --exclude-globbing-filelist ${HOME}/.local/etc/duplicity.exclude"
EXTRA+=" --exclude ${HOME}/Pictures/Aperture?Library.aplibrary"
EXTRA+=" --exclude ${HOME}/Documents/Dropbox"
SRC="${HOME}"
duplicity $DUPLICITY_ARGS $EXTRA $OPTS $RE $SRC $BACKUPDEST/home/
SRC="${HOME}/Pictures/Aperture?Library.aplibrary"
EXTRA=""
EXTRA+=" --exclude $SRC/Thumbnails"
EXTRA+=" --exclude $SRC/Previews"
duplicity $DUPLICITY_ARGS $EXTRA $OPTS $RE $SRC $BACKUPDEST/aperture/
EXTRA=""
SRC="${HOME}/Documents/Dropbox"
duplicity $DUPLICITY_ARGS $EXTRA $OPTS $RE $SRC $BACKUPDEST/dropbox/
EXTRA="
--exclude-globbing-filelist
${HOME}/.local/etc/duplicity.applications.exclude
"
SRC="/Applications"
duplicity $DUPLICITY_ARGS $EXTRA $OPTS $RE $SRC $BACKUPDEST/apps/