From 33365d09530426b15fa7395c77fab4d163d8e684 Mon Sep 17 00:00:00 2001
From: intrigeri <intrigeri@boum.org>
Date: Thu, 6 May 2010 19:27:18 +0200
Subject: [PATCH] dup: use --archive-dir /var/backups/duplicity  unless the
 user has specified it (Closes: 580213)

---
 ChangeLog       | 3 +++
 handlers/dup.in | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index f09d1d45..db140ba8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,9 @@ version 0.9.8 -- UNRELEASED
 	   0.6.01 or newer, that depends on local caching (Closes: #572721)
 	 . dup: ignore anything but digits and "." when comparing versions
 	   (Closes: #578987)
+	 . Put archive directory (cache) into /var/backups/duplicity rather
+	   than the default /root/.cache/duplicity, unless the user
+	   has specified it (Closes: 580213)
 
 version 0.9.7 -- January 27, 2010
     backupninja changes
diff --git a/handlers/dup.in b/handlers/dup.in
index 16b5af2a..b881b0af 100644
--- a/handlers/dup.in
+++ b/handlers/dup.in
@@ -193,6 +193,15 @@ if [ -n "$tmpdir" ]; then
    precmd="${precmd}TMPDIR=$tmpdir "
 fi
 
+### Archive directory
+# duplicity >= 0.6.01 enables the archive_dir by default, let's put it into /var/backups
+# unless the user has specified it.
+if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 6 -a "$duplicity_sub" -ge 1 ]; then
+   if echo "${options}" | grep -qv -- "--archive-dir" ; then
+      execstr_options="${execstr_options} --archive-dir /var/backups/duplicity"
+   fi
+fi
+
 ### Cleanup old backup sets (or not)
 if [ "$keep" != "yes" ]; then
    if [ "`echo $keep | tr -d 0-9`" == "" ]; then
-- 
GitLab