Skip to content

Instantly share code, notes, and snippets.

@barrucadu
Last active February 25, 2019 21:11
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 barrucadu/be35b8d13a5abb944bbe52a78c7c887a to your computer and use it in GitHub Desktop.
Save barrucadu/be35b8d13a5abb944bbe52a78c7c887a to your computer and use it in GitHub Desktop.
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p duplicity
set -e
# location of scripts
BACKUP_SCRIPT_DIR=$HOME/backup-scripts
# hostname
MY_HOST=`hostname`
# aws config
AWS_PROFILE="backup"
AWS_S3_BUCKET="barrucadu-backup"
if [[ ! -e $BACKUP_SCRIPT_DIR/passphrase.sh ]]; then
echo 'missing passphrase file!'
exit 1
fi
if [[ -x "${BACKUP_SCRIPT_DIR}/host-scripts/${MY_HOST}" ]]; then
DIR=`mktemp -d`
trap "rm -rf $DIR" EXIT
cd $DIR
# generates a backup in ./$MY_HOST
time $BACKUP_SCRIPT_DIR/host-scripts/$MY_HOST
source $BACKUP_SCRIPT_DIR/passphrase.sh
time \
AWS_PROFILE=$AWS_PROFILE \
PASSPHRASE=$PASSPHRASE \
duplicity incremental \
--s3-use-new-style \
--asynchronous-upload \
--full-if-older-than 28D \
--verbosity notice \
$MY_HOST \
"s3+http://${AWS_S3_BUCKET}/${MY_HOST}"
else
echo 'nothing to do!'
fi
Failed to import the site module
Traceback (most recent call last):
File "/nix/store/c2k79r69qyhszcv5s9fz19k25m4i469g-python2.7-setuptools-40.2.0/lib/python2.7/site-packages/site.py", line 73, in <module>
__boot()
File "/nix/store/c2k79r69qyhszcv5s9fz19k25m4i469g-python2.7-setuptools-40.2.0/lib/python2.7/site-packages/site.py", line 26, in __boot
import imp # Avoid import loop in Python 3
File "/nix/store/vp7mwr3wx0a8a6bg7ifg9iq1wk6n0w6j-python3-3.6.8/lib/python3.6/imp.py", line 27, in <module>
import tokenize
File "/nix/store/vp7mwr3wx0a8a6bg7ifg9iq1wk6n0w6j-python3-3.6.8/lib/python3.6/tokenize.py", line 33, in <module>
import re
File "/nix/store/vp7mwr3wx0a8a6bg7ifg9iq1wk6n0w6j-python3-3.6.8/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment