Support duplicity >= 0.4.3 invocation syntax

This commit is contained in:
intrigeri 2007-10-15 20:55:59 +00:00
parent 5cda2e3cac
commit f7f20cd4af
2 changed files with 25 additions and 7 deletions

View File

@ -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

View File

@ -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