fe55d48cbbc6832e2cfe51102bf2694b955bd7c5

Author
Zertrin <zertrin@gmail.com>
Committer
Zertrin <zertrin@gmail.com>
Date

Message

v0.7 : external config file now mandatory + fix issue #1

Diff

This diff is truncated to protect this page.

  1diff --git a/CHANGELOG b/CHANGELOG
  2index 3249ff0063cf90b03d274bcc3b4e24d4391151ab..65c47b888670ce3f92d85eabd50d2fcbb6aedea9 100644
  3--- a/CHANGELOG
  4+++ b/CHANGELOG
  5@@ -1,3 +1,8 @@
  6+0.7 (8 July 2012)
  7+=================
  8+  * Fix Issue #1 "Restore error if no target name"
  9+  * Rewrite to force utilisation of an external config file to facilitate updates of the script in itself
 10+
 11 0.6.1 (5 May 2012)
 12 =================
 13 Inclusion of two patches written by [shamer] + modified config file management.
 14diff --git a/README b/README
 15index 4f49a391e8e57516d92cd41a19c7641baf5232b6..5199f148dc96e874dc8f62e6815c20a0e8b1c977 100644
 16--- a/README
 17+++ b/README
 18@@ -1,11 +1,11 @@
 19 ABOUT THIS SCRIPT
 20 =================
 21 
 22-This bash script was designed to automate and simplify the remote backup
 23-process of duplicity on Amazon S3 primarily. Other backup destinations are
 24-possible. After your script is configured, you can easily backup, restore,
 25-verify and clean (either via cron or manually) your data without having to
 26-remember lots of different command options and passphrases.
 27+This bash script was designed to automate and simplify the remote backup process
 28+of duplicity on Amazon S3 primarily. Other backup destinations are possible.
 29+After your script is configured, you can easily backup, restore, verify and
 30+clean (either via cron or manually) your data without having to remember lots of
 31+different command options and passphrases.
 32 
 33 Most importantly, you can easily backup the script and your gpg key in a
 34 convenient passphrase-encrypted file.  This comes in in handy if/when your
 35@@ -15,8 +15,8 @@ Optionally, you can set up an email address where the log file will be sent,
 36 which is useful when the script is used via cron.
 37 
 38 This version is a rewriting of the code originally written by Damon Timm,
 39-including many patches that have been brought to the original scripts by
 40-various forks on Github.
 41+including many patches that have been brought to the original scripts by various
 42+forks on Github.
 43 
 44 Latest version of the code available at:
 45 http://github.com/zertrin/duplicity-backup
 46@@ -24,7 +24,7 @@ http://github.com/zertrin/duplicity-backup
 47 Merge requests are welcome :)
 48 
 49 More information about this script available at:
 50-http://zertrin.org/duplicity-backup.html
 51+http://zertrin.org/projects/duplicity-backup/
 52 
 53 The original version of the code is availabe at:
 54 http://github.com/theterran/dt-s3-backup
 55@@ -32,10 +32,11 @@ http://github.com/theterran/dt-s3-backup
 56 BEFORE YOU START
 57 ================
 58 
 59-This script requires user configuration.  Instructions are in
 60-the file itself and should be self-explanatory.  Be sure to replace all the
 61-*foobar* values with your real ones.  Almost every value needs to be
 62-configured in someway.
 63+This script requires user configuration. Instructions are in the config file
 64+itself and should be self-explanatory. Please DO NOT edit the example config
 65+file, but make a copy of it and edit this one. Be sure to replace all the
 66+*foobar* values with your real ones. Almost every value needs to be configured
 67+in someway.
 68 
 69 You can use multiple copies of the script with different settings for different
 70 backup scenarios.  It is designed to run as a cron job and will log information
 71@@ -54,11 +55,11 @@ REQUIREMENTS
 72 CONFIGURATION
 73 =============
 74 
 75-The configuration takes place directly in the script and is documented there.
 76+The configuration takes place in a separate config file and is documented there.
 77 
 78-You can optionnaly specifiy a custom config file in the CONFIG parameter at the
 79-very beginning. Any parameter specified in this custom config file will
 80-override thoses specified in the script.
 81+The script looks for its configuration by reading the config file specified in
 82+the CONFIG parameter at the beggining of the script. Be sure to edit it to match
 83+the actual location of your config file.
 84 
 85 COMMON USAGE EXAMPLES
 86 =====================
 87@@ -103,15 +104,14 @@ TROUBLESHOOTING
 88 
 89 This script attempts to simplify the task of running a duplicity command; if you
 90 are having any problems with the script the first step is to determine if the
 91-script is generating an incorrect command or if duplicity itself is
 92-causing your error.
 93+script is generating an incorrect command or if duplicity itself is causing your
 94+error.
 95 
 96 To see exactly what is happening when you run duplicity-backup, head to the bottom
 97-of the user configuration portion of the script and uncomment the `ECHO=$(which
 98-echo)` variable.  This will stop the script from running and will, instead,
 99-output the generated command into your log file. You can then check to see if
100-what is being generated is causing an error or if it is duplicity causing you
101-woe.
102+of the configuration file and uncomment the `ECHO=$(which echo)` variable. This
103+will stop the script from running and will, instead, output the generated
104+command into your log file. You can then check to see if what is being generated
105+is causing an error or if it is duplicity causing you woe.
106 
107 NEXT VERSION WISH LIST
108 ======================
109diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example
110new file mode 100644
111index 0000000000000000000000000000000000000000..9c6b4054aed62a84c8baaf10d5b98d90b1e4e735
112--- /dev/null
113+++ b/duplicity-backup.conf.example
114@@ -0,0 +1,158 @@
115+#!/bin/bash
116+#
117+# Copyright (c) 2008-2010 Damon Timm.
118+# Copyright (c) 2010 Mario Santagiuliana.
119+# Copyright (c) 2012 Marc Gallet.
120+#
121+# This program is free software: you can redistribute it and/or modify it under
122+# the terms of the GNU General Public License as published by the Free Software
123+# Foundation, either version 3 of the License, or (at your option) any later
124+# version.
125+#
126+# This program is distributed in the hope that it will be useful, but WITHOUT
127+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
128+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
129+# details.
130+#
131+# You should have received a copy of the GNU General Public License along with
132+# this program.  If not, see <http://www.gnu.org/licenses/>.
133+#
134+# MORE ABOUT THIS SCRIPT AVAILABLE IN THE README AND AT:
135+#
136+# http://zertrin.org/projects/duplicity-backup/ (for this version)
137+# http://damontimm.com/code/dt-s3-backup (for the original programi by Damon Timm)
138+#
139+# Latest code available at:
140+# http://github.com/zertrin/duplicity-backup
141+#
142+# ---------------------------------------------------------------------------- #
143+
144+# #############################################
145+# #       DUPLICITY-BACKUP CONFIG FILE        #
146+# #############################################
147+
148+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
149+# ! DO NOT edit duplicity-backup.conf.example !
150+# !    please copy it to anywhere you want    !
151+# !     (typically duplicity-backup.conf)     !
152+# !        and edit this file instead         !
153+# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
154+
155+# AMAZON S3 INFORMATION
156+# Comment out this lines if you're not using Amazon S3
157+AWS_ACCESS_KEY_ID="foobar_aws_key_id"
158+AWS_SECRET_ACCESS_KEY="foobar_aws_access_key"
159+
160+# ENCRYPTION INFORMATION
161+# Do you want your backup to be encrypted? yes/no
162+# If yes, please make sure you specify either PASSPHRASE or GPG_KEY
163+ENCRYPTION='yes'
164+
165+# If you are NOT running this from a cron, comment this line out
166+# and duplicity should prompt you for your password.
167+# Comment out if you aren't using encryption
168+PASSPHRASE="foobar_gpg_passphrase"
169+
170+# Specify which GPG key you would like to use (even if you have only one).
171+# Comment out if you're using only PASSPHRASE or not using encryption
172+GPG_KEY="foobar_gpg_key"
173+
174+# BACKUP SOURCE INFORMATION
175+# The ROOT of your backup (where you want the backup to start);
176+# This can be / or somwhere else -- I use /home/ because all the
177+# directories start with /home/ that I want to backup.
178+ROOT="/home"
179+
180+# BACKUP DESTINATION INFORMATION
181+# In my case, I use Amazon S3 use this - so I made up a unique
182+# bucket name (you don't have to have one created, it will do it
183+# for you).  If you don't want to use Amazon S3, you can backup
184+# to a file or any of duplicity's supported outputs.
185+#
186+# NOTE: You do need to keep the "s3+http://<your location>/" format
187+# even though duplicity supports "s3://<your location>/".
188+DEST="s3+http://backup-bucket/backup-folder/"
189+# Other possible locations
190+#DEST="ftp://user[:password]@other.host[:port]/some_dir"
191+#DEST="rsync://user@host.com[:port]//absolute_path"
192+#DEST="scp://user[:password]@other.host[:port]/[/]some_dir"
193+#DEST="ssh://user[:password]@other.host[:port]/[/]some_dir"
194+#DEST="file:///home/foobar_user_name/new-backup-test/"
195+
196+# INCLUDE LIST OF DIRECTORIES
197+# Here is a list of directories to include; if you want to include
198+# everything that is in root, you could leave this list empty (I think).
199+#
200+# Here is an example with multiple locations:
201+#INCLIST=(  "/home/*/Documents" \
202+#           "/home/*/Projects" \
203+#           "/home/*/logs" \
204+#           "/home/www/mysql-backups" \
205+#        )
206+#
207+# Simpler example with one location:
208+INCLIST=( "/home/foobar_user_name/Documents/Prose/" ) 
209+
210+# EXCLUDE LIST OF DIRECTORIES
211+# Even though I am being specific about what I want to include,
212+# there is still a lot of stuff I don't need.
213+EXCLIST=(   "/home/*/Trash" \
214diff --git a/duplicity-backup.sh b/duplicity-backup.sh
215index ed385c00ffca2d39f231c8302290d55c9b656ce1..21471800fbdcf5fb2ab8a8d888e8759e59f1ab9a 100755
216--- a/duplicity-backup.sh
217+++ b/duplicity-backup.sh
218@@ -19,7 +19,7 @@
219 #
220 # MORE ABOUT THIS SCRIPT AVAILABLE IN THE README AND AT:
221 #
222-# http://zertrin.org/duplicity-backup.html (for this version)
223+# http://zertrin.org/projects/duplicity-backup/ (for this version)
224 # http://damontimm.com/code/dt-s3-backup (for the original programi by Damon Timm)
225 #
226 # Latest code available at:
227@@ -27,127 +27,9 @@
228 #
229 # ---------------------------------------------------------------------------- #
230 
231-# Set config file (uncomment if you want to use a separate config file)
232-# Its content override config below !
233-#CONFIG="/some/path/to/config/file"
234-
235-# AMAZON S3 INFORMATION
236-# Comment out this lines if you're not using S3
237-AWS_ACCESS_KEY_ID="foobar_aws_key_id"
238-AWS_SECRET_ACCESS_KEY="foobar_aws_access_key"
239-
240-# ENCRYPTION INFORMATION
241-# If you aren't running this from a cron, comment this line out
242-# and duplicity should prompt you for your password.
243-# Comment out if you're using only GPG_KEY or not using encryption
244-PASSPHRASE="foobar_gpg_passphrase"
245-
246-# Specify which GPG key you would like to use (even if you have only one).
247-# Comment out if you're using only PASSPHRASE or not using encryption
248-GPG_KEY="foobar_gpg_key"
249-
250-# Do you want your backup to be encrypted? yes/no
251-# If yes, please make sure you specify either PASSPHRASE OR GPG_KEY
252-ENCRYPTION='yes'
253-
254-# BACKUP SOURCE INFORMATION
255-# The ROOT of your backup (where you want the backup to start);
256-# This can be / or somwhere else -- I use /home/ because all the
257-# directories start with /home/ that I want to backup.
258-ROOT="/home"
259-
260-# BACKUP DESTINATION INFORMATION
261-# In my case, I use Amazon S3 use this - so I made up a unique
262-# bucket name (you don't have to have one created, it will do it
263-# for you).  If you don't want to use Amazon S3, you can backup
264-# to a file or any of duplicity's supported outputs.
265-#
266-# NOTE: You do need to keep the "s3+http://<your location>/" format
267-# even though duplicity supports "s3://<your location>/".
268-DEST="s3+http://backup-bucket/backup-folder/"
269-# Other possible locations
270-#DEST="ftp://user[:password]@other.host[:port]/some_dir"
271-#DEST="rsync://user@host.com[:port]//absolute_path"
272-#DEST="ssh://user[:password]@other.host[:port]/[/]some_dir"
273-#DEST="file:///home/foobar_user_name/new-backup-test/"
274-
275-# INCLUDE LIST OF DIRECTORIES
276-# Here is a list of directories to include; if you want to include
277-# everything that is in root, you could leave this list empty (I think).
278-#
279-# Here is an example with multiple locations:
280-#INCLIST=(  "/home/*/Documents" \
281-#           "/home/*/Projects" \
282-#           "/home/*/logs" \
283-#           "/home/www/mysql-backups" \
284-#        )
285-#
286-# Simpler example with one location:
287-INCLIST=( "/home/foobar_user_name/Documents/Prose/" ) 
288-
289-# EXCLUDE LIST OF DIRECTORIES
290-# Even though I am being specific about what I want to include,
291-# there is still a lot of stuff I don't need.
292-EXCLIST=(   "/home/*/Trash" \
293-            "/home/*/Projects/Completed" \
294-            "/**.DS_Store" "/**Icon?" "/**.AppleDouble" \
295-        )
296-
297-# STATIC BACKUP OPTIONS
298-# Here you can define the static backup options that you want to run with
299-# duplicity.  I use both the `--full-if-older-than` option plus the
300-# `--s3-use-new-style` option (for European buckets).  Be sure to separate your
301-# options with appropriate spacing.
302-STATIC_OPTIONS="--full-if-older-than 14D --s3-use-new-style"
303-
304-# FULL BACKUP & REMOVE OLDER THAN SETTINGS
305-# Because duplicity will continue to add to each backup as you go,
306-# it will eventually create a very large set of files.  Also, incremental
307-# backups leave room for problems in the chain, so doing a "full"
308-# backup every so often isn't not a bad idea.
309-#
310-# You can either remove older than a specific time period:
311-#CLEAN_UP_TYPE="remove-older-than"
312-#CLEAN_UP_VARIABLE="31D"
313-
314-# Or, If you would rather keep a certain (n) number of full backups (rather
315-# than removing the files based on their age), you can use what I use:
316-CLEAN_UP_TYPE="remove-all-but-n-full"
317-CLEAN_UP_VARIABLE="2"