diff --git a/AUTHORS b/AUTHORS index 93fbc17192eeb2ea5658a5ff9fe9174ff399082b..085e5facecaf7ff591d813a194178c2f897d5d1e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -55,3 +55,4 @@ Christian Prause <cprause@suse.com> -- Support suse in the sys handler Jools Wills <jools@oxfordinspire.co.uk> -- Bugfix in the sys helper, indentation fixes Mark Janssen <mark@sig-io.nl> -- ignore jobs whose filename ends with "~" shred <riseup@ml.shredzone.de> -- Initial patch for test mode support in the rsync handler +Daniel Lo Nigro <daniel@dan.cx> -- Dropbox support for Duplicity diff --git a/examples/example.dup b/examples/example.dup index 067b6b1adde41246eb5e7c662d7770d233012e75..9b60f770eee94dbb70e6da56102c1cf7a934f46a 100644 --- a/examples/example.dup +++ b/examples/example.dup @@ -189,6 +189,7 @@ exclude = /var/cache/backupninja/duplicity ## desturl = rsync://user@other.host//var/backup/bla ## desturl = s3+http:// ## desturl = ftp://myftpuser@ftp.example.org/remote/ftp/path +## desturl = dpbx:///myserver ## the default value of this configuration option is not set: ## ## Default: @@ -213,6 +214,16 @@ exclude = /var/cache/backupninja/duplicity # cfapikey = # cfauthurl = +## Dropbox requires a valid authentication token. To obtain one, you will need +## to create a Dropbox API application at https://www.dropbox.com/developers/apps/create. +## See the "A note on Dropbox access" section of the Duplicity manpage for more +## details: http://duplicity.nongnu.org/duplicity.1.html#sect12 +## +## Default: +# dropboxappkey = +# dropboxappsecret = +# dropboxaccesstoken = + ## FTP password, needed for backups using desturl = ftp://... ## ## Default: diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index 6f3281e0e1050a450f64475144a58f84db74cd18..a6050af788b9929d645c8e544eb326cfbbd80be3 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -470,6 +470,7 @@ keepincroffulls = $dup_keepincroffulls #desturl = rsync://user@other.host//var/backup/bla #desturl = s3+http://your_bucket #desturl = ftp://myftpuser@ftp.example.org/remote/ftp/path +#desturl = dpbx:///myserver # Amazon Web Services Access Key ID and Secret Access Key, needed for backups # to S3 buckets. @@ -486,6 +487,16 @@ keepincroffulls = $dup_keepincroffulls # cfapikey = # cfauthurl = +## Dropbox requires a valid authentication token. To obtain one, you will need +## to create a Dropbox API application at https://www.dropbox.com/developers/apps/create. +## See the "A note on Dropbox access" section of the Duplicity manpage for more +## details: http://duplicity.nongnu.org/duplicity.1.html#sect12 +## +## Default: +# dropboxappkey = +# dropboxappsecret = +# dropboxaccesstoken = + # FTP password, needed for backups using desturl = ftp://... #ftp_password = diff --git a/handlers/dup.in b/handlers/dup.in index 3c586c6aa92ba3b1f71905ec823af52123989538..43b282fc6dfdd09d06b70957aa4f3fabca99d495 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -34,6 +34,9 @@ getconf awssecretaccesskey getconf cfusername getconf cfapikey getconf cfauthurl +getconf dropboxappkey +getconf dropboxappsecret +getconf dropboxaccesstoken getconf ftp_password getconf sshoptions getconf bandwidthlimit 0 @@ -54,6 +57,16 @@ fi if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "cf+http" ]; then [ -n "$cfusername" -a -n "$cfapikey" ] || fatal "Cloudfiles access keys must be set for S3 backups." fi +if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "dpbx" ]; then + [ -n "$dropboxappkey" -a -n "$dropboxappsecret" ] || fatal "Dropbox app ID and secret must be set for Dropbox backups." + + if [ ! -n "$dropboxaccesstoken" ]; then + error "To obtain an access token for Dropbox, you will need to manually run this command:" + error "DPBX_APP_KEY=$dropboxappkey DPBX_APP_SECRET=$dropboxappsecret duplicity list-current-files $desturl" + fatal "Dropbox access token must be set" + fi +fi + if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "ftp" ]; then [ -n "$ftp_password" ] || fatal "ftp_password must be set for FTP backups." fi @@ -279,6 +292,13 @@ if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "cf+http" ]; then fi fi +### If desturl is a Dropbox URL, export the relevant environment variables +if [ "`echo $desturl | @AWK@ -F ':' '{print $1}'`" == "dpbx" ]; then + export DPBX_APP_KEY="$dropboxappkey" + export DPBX_APP_SECRET="$dropboxappsecret" + export DPBX_ACCESS_TOKEN="$dropboxaccesstoken" +fi + ### Cleanup commands (duplicity >= 0.4.4) # cleanup