aboutsummaryrefslogtreecommitdiff
path: root/handlers
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2010-10-12 11:44:35 +0200
committerintrigeri <intrigeri@boum.org>2010-10-12 11:44:35 +0200
commitdc7f723e5c784379e8900f9dee4efaa3f851c0fb (patch)
tree633f2707c86223c9c2ef3237d663d941e12ee907 /handlers
parent55d9452da51c5695a96d3a6152577fe44e56ffef (diff)
downloadbackupninja-dc7f723e5c784379e8900f9dee4efaa3f851c0fb.tar.gz
backupninja-dc7f723e5c784379e8900f9dee4efaa3f851c0fb.tar.bz2
Remove support for duplicity < 0.4.4. Even etch-backports has a newer one.
Diffstat (limited to 'handlers')
-rw-r--r--handlers/dup.in92
1 files changed, 29 insertions, 63 deletions
diff --git a/handlers/dup.in b/handlers/dup.in
index ae93898..3ffc6ab 100644
--- a/handlers/dup.in
+++ b/handlers/dup.in
@@ -2,7 +2,7 @@
# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
#
# duplicity script for backupninja
-# requires duplicity
+# requires duplicity >= 0.4.4
#
getconf options
@@ -106,35 +106,14 @@ 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}'`"
-### ssh/scp/sftp options
-# 1. duplicity >= 0.4.2 needs --sftp-command
-# (NB: sftp does not support the -l option)
-# 2. duplicity 0.4.3 to 0.4.9 replace --ssh-command with --ssh-options, which is
-# passed to scp and sftp commands by duplicity. 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
-
+### 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"
fi
-
-# < 0.4.2 : only uses ssh and scp
-if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -lt 2 ]; then
- execstr_options="${execstr_options} --scp-command 'scp $scpoptions' --ssh-command 'ssh $sshoptions'"
-# >= 0.4.2 : also uses sftp, --sftp-command option is now supported
-else
- 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_options="${execstr_options} --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_options="${execstr_options} --scp-command 'scp $scpoptions' --sftp-command 'sftp $sftpoptions'"
- fi
-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
@@ -162,12 +141,7 @@ fi
# full backup.
# If incremental==no, force a full backup anyway.
if [ "$incremental" == "no" ]; then
- # before 0.4.4, full was an option and not a command
- if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -lt 4 ]; then
- execstr_options="${execstr_options} --full"
- else
- execstr_command="full"
- fi
+ execstr_command="full"
else
# we're in incremental mode
if [ "$increments" != "keep" ]; then
@@ -210,10 +184,6 @@ if [ "$keep" != "yes" ]; then
if [ "`echo $keep | tr -d 0-9`" == "" ]; then
keep="${keep}D"
fi
- # before 0.4.4, remove-older-than was an option and not a command
- if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -lt 4 ]; then
- execstr_options="${execstr_options} --remove-older-than $keep"
- fi
fi
### Source
@@ -268,43 +238,39 @@ fi
### Cleanup commands (duplicity >= 0.4.4)
# cleanup
-if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 4 ]; then
- debug "duplicity cleanup --force $execstr_options $execstr_serverpart"
+debug "duplicity cleanup --force $execstr_options $execstr_serverpart"
+if [ ! $test ]; then
+ export PASSPHRASE=$password
+ export FTP_PASSWORD=$ftp_password
+ output=`nice -n $nicelevel \
+ su -c \
+ "duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"`
+ exit_code=$?
+ if [ $exit_code -eq 0 ]; then
+ debug $output
+ info "Duplicity cleanup finished successfully."
+ else
+ debug $output
+ warning "Duplicity cleanup failed."
+ fi
+fi
+
+# remove-older-than
+if [ "$keep" != "yes" ]; then
+ debug "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart"
if [ ! $test ]; then
export PASSPHRASE=$password
export FTP_PASSWORD=$ftp_password
output=`nice -n $nicelevel \
- su -c \
- "duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"`
+ su -c \
+ "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"`
exit_code=$?
if [ $exit_code -eq 0 ]; then
debug $output
- info "Duplicity cleanup finished successfully."
+ info "Duplicity remove-older-than finished successfully."
else
debug $output
- warning "Duplicity cleanup failed."
- fi
- fi
-fi
-
-# remove-older-than
-if [ "$keep" != "yes" ]; then
- if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 4 ]; then
- debug "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart"
- if [ ! $test ]; then
- export PASSPHRASE=$password
- export FTP_PASSWORD=$ftp_password
- output=`nice -n $nicelevel \
- su -c \
- "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"`
- exit_code=$?
- if [ $exit_code -eq 0 ]; then
- debug $output
- info "Duplicity remove-older-than finished successfully."
- else
- debug $output
- warning "Duplicity remove-older-than failed."
- fi
+ warning "Duplicity remove-older-than failed."
fi
fi
fi