Skip to content

Instantly share code, notes, and snippets.

@chihchun
Created July 19, 2010 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chihchun/481254 to your computer and use it in GitHub Desktop.
Save chihchun/481254 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Rex Tsai <chihchun@kalug.linux.org.tw>
BKDIR=/media/backup/backup
KEY=DC76FEB9
# OP=incremental
# OP=full
# OP=collection-status
# OP=cleanup
# OP="remove-older-than time"
# OP=list-current-files
# OP=verify
OP=$1
TARGET=$2
set -e
function askpass ()
{
if [ -z $PASSPHRASE ] ; then
echo -n "GnuPG passphrase: "
read -s PASSPHRASE
export PASSPHRASE
fi
}
if [ ! -d $BKDIR ] ; then
echo "$BKDIR does not exist"
exit -1
fi
askpass
if [ x"$TARGET" == x ] || [ $TARGET == 'workspace' ] ; then
nice -n 19 \
duplicity ${OP} --encrypt-key ${KEY} \
--include "${HOME}/workspace/Projects" \
--include "${HOME}/workspace/routers" \
--include "${HOME}/workspace/qrc0cde" \
--include "${HOME}/workspace/gae" \
--include "${HOME}/workspace/ubiquity" \
--include "${HOME}/workspace/cakephp" \
--include "${HOME}/workspace/greasemonkey" \
--include "${HOME}/workspace/certalert" \
--exclude '**'\
--allow-source-mismatch \
--verbosity info \
${HOME}/workspace \
file://${BKDIR}/workspace
fi
# stuff
if [ x"$TARGET" == x ] || [ $TARGET == 'stuff' ] ; then
nice -n 19 \
duplicity ${OP} --encrypt-key ${KEY} \
--include "${HOME}/stuff" \
--include "${HOME}/Desktop" \
--include "${HOME}/.liferea_1.6/feedlist.opml" \
--include "${HOME}/.tomboy" \
--include "${HOME}/.config/gpodder/channels.opml" \
--include "${HOME}/.openoffice.org" \
--include "${HOME}/.xchat2" \
--include "${HOME}/.Skype" \
--include "${HOME}/.gnome" \
--include "${HOME}/.gnome2" \
--include "${HOME}/.local" \
--exclude '**'\
--allow-source-mismatch \
--verbosity info \
/ \
file://${BKDIR}/stuff
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment