patch: support for duplicity S3 backups
I have used the duplicity handler for doing S3 backups and would want to contribute the necessary modifications to backupninja. There's a patch that can be used with the desturl option. My proposal is to make a complete handler for doing S3 backups with duplicity because it requires the python-boto package and a separate helper would also be more convenient for configuration. So what do you think?
Here's the patch
diff --git a/trunk/handlers/dup.helper.in b/trunk/handlers/dup.helper.in
index c1fbdd5..caa78d3 100644
--- a/trunk/handlers/dup.helper.in
+++ b/trunk/handlers/dup.helper.in
@@ -424,6 +424,11 @@ desthost = $dup_desthost
# without specifying a password (if type = remote).
destuser = $dup_destuser
+# Amazon AWS account access identifiers
+# must be given when desturl is an Amazon S3 bucket
+awsaccesskeyid = $dup_awsaccesskeyid
+awssecretaccesskey = $dup_awssecretaccesskey
+
EOF
chmod 600 $next_filename
diff --git a/trunk/handlers/dup.in b/trunk/handlers/dup.in
index 9c6a493..5cca111 100644
--- a/trunk/handlers/dup.in
+++ b/trunk/handlers/dup.in
@@ -30,6 +30,8 @@ getconf bandwidthlimit 0
getconf desthost
getconf destdir
getconf destuser
+getconf awsaccesskeyid
+getconf awssecretaccesskey
destdir=${destdir%/}
### SANITY CHECKS ##############################################################
@@ -217,6 +219,7 @@ set +o noglob
execstr_source=${execstr_source//\\*/\\\\\\*}
+
### Cleanup commands (duplicity >= 0.4.4)
# cleanup
@@ -224,6 +227,8 @@ if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -g
debug "$precmd duplicity cleanup --force $execstr_options $execstr_serverpart"
if [ ! $test ]; then
export PASSPHRASE=$password
+ export AWS_ACCESS_KEY_ID=$awsaccesskeyid
+ export AWS_SECRET_ACCESS_KEY=$awssecretaccesskey
output=`nice -n $nicelevel \
su -c \
"$precmd duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"`
@@ -244,6 +249,8 @@ if [ "$keep" != "yes" ]; then
debug "$precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart"
if [ ! $test ]; then
export PASSPHRASE=$password
+ export AWS_ACCESS_KEY_ID=$awsaccesskeyid
+ export AWS_SECRET_ACCESS_KEY=$awssecretaccesskey
output=`nice -n $nicelevel \
su -c \
"$precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"`
@@ -263,6 +270,8 @@ fi
debug "$precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart"
if [ ! $test ]; then
export PASSPHRASE=$password
+ export AWS_ACCESS_KEY_ID=$awsaccesskeyid
+ export AWS_SECRET_ACCESS_KEY=$awssecretaccesskey
output=`nice -n $nicelevel \
su -c \
"$precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart 2>&1"`
(from redmine: created on 2009-03-21, closed on 2010-01-09)