07c1fd2867f8648454c744bedaa38609bf89c297

Author
Yaron de Leeuw <jarondl@server.fake>
Committer
Yaron de Leeuw <jarondl@server.fake>
Date

Message

Added the option to skip cleanup

I've added the option to skip cleanup by setting CLEANUP_TYPE to  'none'.
This is relevant to me because my s3 api key is not allowed to delete files,
making my backup more resistable to human error / someone getting hold of this
plaintext accessible key.

Diff

 1diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example
 2index 1bd0cd9ce3cf03212c22b322f8b98cb0e10ea600..37ecf770075bfc0a4891fb748b08d23f94b27000 100644
 3--- a/duplicity-backup.conf.example
 4+++ b/duplicity-backup.conf.example
 5@@ -192,7 +192,7 @@ STATIC_OPTIONS="--full-if-older-than 14D --s3-use-new-style"
 6 # backups leave room for problems in the chain, so doing a "full"
 7 # backup every so often is not a bad idea.
 8 #
 9-# You can either remove older than a specific time period:
10+# You can remove older than a specific time period:
11 #CLEAN_UP_TYPE="remove-older-than"
12 #CLEAN_UP_VARIABLE="31D"
13 #
14@@ -200,6 +200,9 @@ STATIC_OPTIONS="--full-if-older-than 14D --s3-use-new-style"
15 # than removing the files based on their age), you can use what I use:
16 CLEAN_UP_TYPE="remove-all-but-n-full"
17 CLEAN_UP_VARIABLE="4"
18+
19+# The third option is to skip cleanup altogether, by:
20+# CLEAN_UP_TYPE="none"
21 #
22 # In combination with "remove-older-than" clean-up type, you may want
23 # to keep only the full backups older than (n) number backup sets. For example, 
24diff --git a/duplicity-backup.sh b/duplicity-backup.sh
25index 983c4f124aa4b92d7ae50a44ab12f3668cb65a3f..ba77119eb01de413c11dc514f2a3cb0d2bcdad10 100755
26--- a/duplicity-backup.sh
27+++ b/duplicity-backup.sh
28@@ -425,11 +425,13 @@ include_exclude()
29 
30 duplicity_cleanup()
31 {
32-  echo "-----------[ Duplicity Cleanup ]-----------" >> ${LOGFILE}
33-  eval ${ECHO} ${DUPLICITY} ${CLEAN_UP_TYPE} ${CLEAN_UP_VARIABLE} ${STATIC_OPTIONS} --force \
34-      ${ENCRYPT} \
35-      ${DEST} >> ${LOGFILE}
36-  echo >> ${LOGFILE}
37+	echo "-----------[ Duplicity Cleanup ]-----------" >> ${LOGFILE}
38+	if [[ "${CLEAN_UP_TYPE}" != "none" ]]; then
39+	  eval ${ECHO} ${DUPLICITY} ${CLEAN_UP_TYPE} ${CLEAN_UP_VARIABLE} ${STATIC_OPTIONS} --force \
40+		    ${ENCRYPT} \
41+			  ${DEST} >> ${LOGFILE}
42+	  echo >> ${LOGFILE}
43+	fi
44   if [ ! -z ${REMOVE_INCREMENTALS_OLDER_THAN} ] && [[ ${REMOVE_INCREMENTALS_OLDER_THAN} =~ ^[0-9]+$ ]]; then
45     eval ${ECHO} ${DUPLICITY} remove-all-inc-of-but-n-full ${REMOVE_INCREMENTALS_OLDER_THAN} \
46       ${STATIC_OPTIONS} --force \