]> gitweb.fluxo.info Git - backupninja.git/commitdiff
Use --ssh-options with dup >= 0.6.17.
authorintrigeri <intrigeri@boum.org>
Sun, 29 Jan 2012 13:39:39 +0000 (14:39 +0100)
committerintrigeri <intrigeri@boum.org>
Sun, 29 Jan 2012 14:09:37 +0000 (15:09 +0100)
... and warn about unsupported options.

examples/example.dup
handlers/dup.helper.in
handlers/dup.in

index 77bda836728a590a8d1bf0e31f53d8adeb69bf78..55ac565cd6801df15727e6c3d27964aefffe296d 100644 (file)
@@ -217,12 +217,18 @@ exclude = /var/cache/backupninja/duplicity
 ## Default:
 # bandwidthlimit = 0
 
+## duplicity < 0.6.17
+## ------------------
 ## passed directly to ssh, scp (and sftp in duplicity >=0.4.2)
 ## warning: sftp does not support all scp options, especially -i; as
 ## a workaround, you can use "-o <SSHOPTION>"
 ## an example setting would be:
 ## sshoptions = -o IdentityFile=/root/.ssh/id_rsa_duplicity
 ##
+## duplicity >= 0.6.17
+## ------------------
+## supports only "-o IdentityFile=..."
+##
 ## Default:
 # sshoptions = 
 
index ba2850f401f814723ca3b7167db672c3cd0cb079..ea794c995aaa12f9a37fd466a343bd8f2e0c1a9f 100644 (file)
@@ -473,11 +473,20 @@ keepincroffulls = $dup_keepincroffulls
 #bandwidthlimit = 128
 bandwidthlimit = $dup_bandwidth
 
-# passed directly to ssh, scp (and sftp in duplicity >=0.4.2)
-# warning: sftp does not support all scp options, especially -i; as
-# a workaround, you can use "-o <SSHOPTION>"
-#sshoptions = -o IdentityFile=/root/.ssh/id_rsa_duplicity
-sshoptions = $dup_sshoptions
+## duplicity < 0.6.17
+## ------------------
+## passed directly to ssh, scp (and sftp in duplicity >=0.4.2)
+## warning: sftp does not support all scp options, especially -i; as
+## a workaround, you can use "-o <SSHOPTION>"
+## an example setting would be:
+## sshoptions = -o IdentityFile=/root/.ssh/id_rsa_duplicity
+##
+## duplicity >= 0.6.17
+## ------------------
+## supports only "-o IdentityFile=..."
+##
+## Default:
+# sshoptions = 
 
 # put the backups under this destination directory
 # if using 'desturl' above, this must not be set
index a3684c8d712017e8cc5c8892db01e2eab0786da8..b358406a5b385a532af4fce337ebb58cab29961a 100644 (file)
@@ -114,13 +114,23 @@ duplicity_minor="`echo $duplicity_version | @AWK@ -F '.' '{print $2}'`"
 duplicity_sub="`echo $duplicity_version | @AWK@ -F '.' '{print $3}'`"
 
 ### ssh/scp/sftp options (duplicity < 0.4.3 is unsupported)
-scpoptions="$sshoptions"
-if [ "$bandwidthlimit" != 0 ]; then
-   [ -z "$desturl" ] || warning 'The bandwidthlimit option is not used when desturl is set.'
-   scpoptions="$scpoptions -l $bandwidthlimit"
+## duplicity >= 0.6.17 : paramiko backend
+if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 6 -a "$duplicity_sub" -ge 17 ]; then
+   if [ -n "$sshoptions" ]; then
+      echo "$sshoptions" | grep -Eqs '^-o[[:space:]]*IdentityFile=[^ ]+$' \
+         || warning 'duplicity >= 0.6.17 only supports the IdentityFile SSH option'
+   fi
+   execstr_options="${execstr_options} --ssh-options '$sshoptions'"
+## duplicity < 0.6.17 : scp/sftp backend
+else
+   scpoptions="$sshoptions"
+   if [ "$bandwidthlimit" != 0 ]; then
+      [ -z "$desturl" ] || warning 'The bandwidthlimit option is not used when desturl is set.'
+      scpoptions="$scpoptions -l $bandwidthlimit"
+   fi
+   sftpoptions="$sshoptions"
+   execstr_options="${execstr_options} --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions'"
 fi
-sftpoptions="$sshoptions"
-execstr_options="${execstr_options} --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions'"
 
 ### Symmetric or asymmetric (public/private key pair) encryption
 if [ -n "$encryptkey" ]; then