Created
March 4, 2010 08:48
-
-
Save mkhl/321548 to your computer and use it in GitHub Desktop.
Simple backup to an external volume with `bup`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| VOLUME=Tigh | |
| function die { | |
| echo "`basename -- "$0"`:" "$@" 1>&2 | |
| exit 1 | |
| } | |
| if [[ ! -d "/Volumes/$VOLUME" ]]; then | |
| die "volume \`$VOLUME' not mounted" | |
| fi | |
| if ! command -v "bup" &>/dev/null; then | |
| die "command \`bup' not found" | |
| fi | |
| export BUP_DIR="/Volumes/$VOLUME/.bup" | |
| bup index -u "$HOME" | |
| bup save -n "`id -un`" "$HOME" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| export BUP_DIR="/Volumes/Tigh/.bup" | |
| export GIT_DIR="$BUP_DIR" | |
| for file; do | |
| bupf="`realpath "$file"`.bup" | |
| egrep -q "^$HOME" <<<"$bupf" | |
| sha1="$(git ls-tree `id -un` -- "${bupf#/}" | cut -c13-52)" | |
| bup join "$sha1" > "$bupf" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment