X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=blobdiff_plain;f=handlers%2Fdup.in;h=9848cbc024e981acb5b6c0f09ea91e97de0c184d;hp=edb43ac4b90ddcf8b732f92ae9e7811692e1f48d;hb=f7f20cd4af2633f2fc4d72b221a974380981d29b;hpb=579ea902ba24854b3c9acb307cda7e996e8e41a3 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