From: intrigeri Date: Mon, 15 Oct 2007 20:55:59 +0000 (+0000) Subject: Support duplicity >= 0.4.3 invocation syntax X-Git-Tag: backupninja-0.9.5~27 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=f7f20cd4af2633f2fc4d72b221a974380981d29b;p=matthijs%2Fupstream%2Fbackupninja.git Support duplicity >= 0.4.3 invocation syntax --- diff --git a/ChangeLog b/ChangeLog index ea8d6c4..1d0ac1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,9 @@ version 0.9.5 -- unreleased toint function sometimes) . Fixed reportspace option (Trac#10) handler changes + dup: + . Support duplicity >= 0.4.3 invocation syntax (--ssh-command option + is not supported anymore) ldap: . Fixed shell command quoting issues, missing 'then' clauses, cleaned up compress=yes to be less redundant and not create empty uncompressed file diff --git a/handlers/dup.in b/handlers/dup.in index edb43ac..9848cbc 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -70,22 +70,37 @@ fi ### COMMAND-LINE MANGLING ### -# duplicity >= 0.4.2 needs --sftp-command (NB: sftp does not support the -l option) duplicity_version="`duplicity --version | @AWK@ '{print $2}'`" duplicity_major="`echo $duplicity_version | @AWK@ -F '.' '{print $1}'`" duplicity_minor="`echo $duplicity_version | @AWK@ -F '.' '{print $2}'`" duplicity_sub="`echo $duplicity_version | @AWK@ -F '.' '{print $3}'`" -if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 2 ]; then - sftpoptions="$sshoptions" -fi + +# 1. duplicity >= 0.4.2 needs --sftp-command (NB: sftp does not support the -l option) +# 2. duplicity >= 0.4.3 replaces --ssh-command with --ssh-options, which: +# - is passed to scp and sftp commands by duplicity +# - has a special syntax we can not feed the command line with +# so we don't use it: since this version does not use the ssh command anymore, +# we keep compatibility with our previous config files by passing $sshoptions to +# --scp-command and --sftp-command ourselves scpoptions="$sshoptions" [ "$bandwidthlimit" == 0 ] || scpoptions="$scpoptions -l $bandwidthlimit" -if [ -z "$sftpoptions" ]; then - execstr="$options --no-print-statistics --scp-command 'scp $scpoptions' --ssh-command 'ssh $sshoptions' " +execstr="$options --no-print-statistics " + +# < 0.4.2 : only uses ssh and scp +if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -le 2 ]; then + execstr="$execstr --scp-command 'scp $scpoptions' --ssh-command 'ssh $sshoptions' " +# >= 0.4.2 : also uses sftp, --sftp-command option is now supported else - execstr="$options --no-print-statistics --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions' --ssh-command 'ssh $sshoptions' " + sftpoptions="$sshoptions" + # == 0.4.2 : uses ssh, scp and sftp + if [ "$duplicity_major" -eq 0 -a "$duplicity_minor" -eq 4 -a "$duplicity_sub" -eq 2 ]; then + execstr="$execstr --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions' --ssh-command 'ssh $sshoptions' " + # >= 0.4.3 : uses only scp and sftp, --ssh-command option is not supported anymore + else + execstr="$execstr --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions' " + fi fi # deal with symmetric or asymmetric (public/private key pair) encryption