aboutsummaryrefslogtreecommitdiff
path: root/handlers/dup.in
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2010-01-09 23:14:17 +0100
committerintrigeri <intrigeri@boum.org>2010-01-09 23:14:17 +0100
commit64c4d190a3ab6b4fa60b10208b32f3b270a72482 (patch)
tree9eb0836af6a9576e0a5d415d0a92ba2c153f3e05 /handlers/dup.in
parent0fbd8744f5c10649b7239c3199dae229a30e10a9 (diff)
downloadbackupninja-64c4d190a3ab6b4fa60b10208b32f3b270a72482.tar.gz
backupninja-64c4d190a3ab6b4fa60b10208b32f3b270a72482.tar.bz2
dup: support backups to Amazon S3 buckets
Thanks to stefan <s.freudenberg@jpberlin.de> for the patch. This fixes Redmine bug #658.
Diffstat (limited to 'handlers/dup.in')
-rw-r--r--handlers/dup.in11
1 files changed, 11 insertions, 0 deletions
diff --git a/handlers/dup.in b/handlers/dup.in
index 2f55b9c..ffae48c 100644
--- a/handlers/dup.in
+++ b/handlers/dup.in
@@ -26,6 +26,8 @@ setsection dest
getconf incremental yes
getconf keep 60
getconf desturl
+getconf awsaccesskeyid
+getconf awssecretaccesskey
getconf sshoptions
getconf bandwidthlimit 0
getconf desthost
@@ -38,6 +40,9 @@ destdir=${destdir%/}
[ -n "$desturl" -o -n "$destdir" ] || fatal "The destination directory (destdir) must be set when desturl is not used."
[ -n "$include" -o -n "$vsinclude" ] || fatal "No source includes specified"
[ -n "$password" ] || fatal "The password option must be set."
+if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "s3+http" ]; then
+ [ -n "$awsaccesskeyid" -a -n "$awssecretaccesskey" ] || fatal "AWS access keys must be set for S3 backups."
+fi
### VServers
# If vservers are configured, check that the ones listed in $vsnames do exist.
@@ -227,6 +232,12 @@ set +o noglob
execstr_source=${execstr_source//\\*/\\\\\\*}
+### If desturl is an S3 URL export the AWS environment variables
+if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "s3+http" ]; then
+ export AWS_ACCESS_KEY_ID="$awsaccesskeyid"
+ export AWS_SECRET_ACCESS_KEY="$awssecretaccesskey"
+fi
+
### Cleanup commands (duplicity >= 0.4.4)
# cleanup