aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-06-24 13:32:34 +0000
committerintrigeri <intrigeri@boum.org>2008-06-24 13:32:34 +0000
commitf0caa9cc1bc25a9944ceb82d33a116e14bee4632 (patch)
tree6fee96e031a05fec75272686e06de5e90e2c34d5
parentc0ca5e3ddaee51add13199ef11e892162c788da5 (diff)
downloadbackupninja-f0caa9cc1bc25a9944ceb82d33a116e14bee4632.tar.gz
backupninja-f0caa9cc1bc25a9944ceb82d33a116e14bee4632.tar.bz2
dup: support every duplicity-supported transport with new configuration option desturl (Closes: #483712, #346040, Trac#2)
-rw-r--r--ChangeLog2
-rw-r--r--examples/example.dup6
-rw-r--r--handlers/dup.helper.in6
-rw-r--r--handlers/dup.in30
4 files changed, 35 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index fd3cc48..2134c3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,8 @@ version 0.9.6 -- unreleased
only trigger a warning on failure, since they should not stop backups
from being done. Also migrated full/incremental backup switch to the
new syntax.
+ . Support every duplicity-supported transport with new configuration
+ option desturl (Closes: #483712, #346040, Trac#2).
ldap:
. support HDB backend just as the BDB one, and make message clearer
when no supported backend is found (Closes: #476910)
diff --git a/examples/example.dup b/examples/example.dup
index d490f74..91ff07e 100644
--- a/examples/example.dup
+++ b/examples/example.dup
@@ -120,6 +120,12 @@ exclude = /home/*/.gnupg
#keep = 60
#keep = yes
+# full destination URL, in duplicity format; if set, desturl overrides
+# sshoptions, destdir, desthost and destuser, and disables testconnect
+# For details, see duplicity manpage, section "URL FORMAT".
+#desturl = file:///usr/local/backup
+#desturl = rsync://user@other.host//var/backup/bla
+
# bandwith limit, in kbit/s ; default is 0, i.e. no limit
#bandwidthlimit = 128
diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in
index eee0256..96828ef 100644
--- a/handlers/dup.helper.in
+++ b/handlers/dup.helper.in
@@ -397,6 +397,12 @@ incremental = $dup_incremental
#keep = yes
keep = $dup_keep
+# full destination URL, in duplicity format; if set, desturl overrides
+# sshoptions, destdir, desthost and destuser, and disables testconnect
+# For details, see duplicity manpage, section "URL FORMAT".
+#desturl = file:///usr/local/backup
+#desturl = rsync://user@other.host//var/backup/bla
+
# bandwith limit, in kbit/s ; default is 0, i.e. no limit
#bandwidthlimit = 128
bandwidthlimit = $dup_bandwidth
diff --git a/handlers/dup.in b/handlers/dup.in
index 00f4b58..cae9909 100644
--- a/handlers/dup.in
+++ b/handlers/dup.in
@@ -24,6 +24,7 @@ getconf exclude
setsection dest
getconf incremental yes
getconf keep 60
+getconf desturl
getconf sshoptions
getconf bandwidthlimit 0
getconf desthost
@@ -33,7 +34,7 @@ destdir=${destdir%/}
### SANITY CHECKS ##############################################################
-[ -n "$destdir" ] || fatal "Destination directory not set"
+[ -n "$desturl" -o -n "$destdir" ] || fatal "The destination directory (destdir) must be set when desturl is not used."
[ -n "$include" ] || fatal "No source includes specified"
[ -n "$password" ] || fatal "The password option must be set."
@@ -58,13 +59,17 @@ fi
### See if we can login on $desthost
if [ "$testconnect" == "yes" ]; then
- debug "ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'"
- if [ ! $test ]; then
- result=`ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'`
- if [ "$result" != "1" ]; then
- fatal "Can't connect to $desthost as $destuser."
- else
- debug "Connected to $desthost as $destuser successfully"
+ if [ -n "$desturl" ]; then
+ warning 'testconnect can not be used when desturl is set'
+ else
+ debug "ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'"
+ if [ ! $test ]; then
+ result=`ssh $sshoptions -o PasswordAuthentication=no $desthost -l $destuser 'echo -n 1'`
+ if [ "$result" != "1" ]; then
+ fatal "Can't connect to $desthost as $destuser."
+ else
+ debug "Connected to $desthost as $destuser successfully"
+ fi
fi
fi
fi
@@ -75,7 +80,14 @@ fi
execstr_command=
execstr_options="$options --no-print-statistics"
execstr_source=
-execstr_serverpart="scp://$destuser@$desthost/$destdir"
+if [ -n "$desturl" ]; then
+ [ -z "$destuser" ] || warning 'the configured destuser is ignored since desturl is set'
+ [ -z "$desthost" ] || warning 'the configured desthost is ignored since desturl is set'
+ [ -z "$destdir" ] || warning 'the configured destdir is ignored since desturl is set'
+ execstr_serverpart="$desturl"
+else
+ execstr_serverpart="scp://$destuser@$desthost/$destdir"
+fi
### duplicity version
duplicity_version="`duplicity --version | @AWK@ '{print $2}'`"