f0697cf5440a503044d991d99a77700d2851cddd
- Author
- TheEdgeOfRage <git@theedgeofrage.com>
- Committer
- TheEdgeOfRage <git@theedgeofrage.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/.travis.yml b/.travis.yml
2deleted file mode 100644
3index c4601abff46c74b149d376fa451d212f197b4c76..0000000000000000000000000000000000000000
4--- a/.travis.yml
5+++ /dev/null
6@@ -1,13 +0,0 @@
7-language: bash
8-
9-# Use container-based infrastructure for quicker build start-up
10-sudo: false
11-
12-before_script:
13- - shellcheck --version
14-
15-script:
16- - shellcheck -e SC2034 duplicity-backup.sh duplicity-backup.conf.example
17-
18-matrix:
19- fast_finish: true
20diff --git a/AUTHORS b/AUTHORS
21deleted file mode 100644
22index 7f38bdf856d37bef91b464c9b7fe33ef33d08d98..0000000000000000000000000000000000000000
23--- a/AUTHORS
24+++ /dev/null
25@@ -1,5 +0,0 @@
26-Damon Timm <damontimm@gmail.com> <http://blog.damontimm.com>
27-Mario Santagiuliana <mario@marionline.it> <http://www.marionline.it>
28-Razvan Marescu <rmarescu+github@gmail.com> <https://github.com/rmarescu>
29-Marc Gallet <zertrin@gmail.com> <https://github.com/zertrin>
30-All commit contributors https://github.com/zertrin/duplicity-backup/graphs/contributors
31diff --git a/CHANGELOG_0.9.x.md b/CHANGELOG_0.9.x.md
32deleted file mode 100644
33index 21564987d9a1de7441a863bb7c6aac25700fa26d..0000000000000000000000000000000000000000
34--- a/CHANGELOG_0.9.x.md
35+++ /dev/null
36@@ -1,107 +0,0 @@
37-Between version 0.10.0 and 0.8.3, versionning had been neglected and no CHANGELOG entry was kept up to date.
38-
39-Here is an export from `git log` for all changes that affected `duplicity-backup.sh` or `duplicity-backup.conf.example` between 2013-01-14 and 2016-08-31.
40-
41-```
42-2016-08-31 23:03:09 +0200 - 73adf5d - Fixes related to new warnings coming from the new version of shellcheck
43-2016-08-31 17:09:28 -0300 - 6ce9a64 - Wrong identation
44-2016-08-31 16:36:29 -0300 - 4f96d72 - Send notification if stale lock is detected
45-2016-08-31 15:26:12 -0300 - 465ae13 - Add IFTTT notification service
46-2016-08-31 15:13:34 -0300 - c9bd2a4 - Add IFTTT notification service
47-2016-07-13 18:23:27 +0200 - 2f07d0e - Adding -e, --cleanup flag...
48-2016-07-03 01:07:08 +0200 - 1604d02 - Support mailx from mailutils
49-2016-06-15 13:38:18 +0200 - 7a84fbd - Fix for issue #128
50-2016-04-29 15:31:56 +0200 - dcdc081 - changed my mind about where to place NOTIFICATION_SERVICE
51-2016-04-29 15:27:40 +0200 - b90289d - minor comment changes to notifications
52-2016-04-28 15:58:49 -0400 - 0501d23 - fixed error
53-2016-04-28 21:28:54 +0200 - 6dc6d19 - Restore the functionality to specify a custom mail script
54-2016-04-23 14:15:09 -0400 - 3ffde78 - Adding Pushover notifications
55-2016-04-06 11:05:19 -0400 - a719668 - added -r flag to bash read to allow backslashes in GPG passphrases
56-2016-04-01 23:21:19 +0200 - fad4bd2 - Full rework of email handling
57-2016-03-28 23:47:39 +0200 - f3f4ddc - rework code for email and notifications (more DRY)
58-2016-03-28 23:21:02 +0200 - 74f637d - Typo
59-2016-03-25 20:40:46 +0100 - bcd64c1 - first iteration after activation of Travis-CI
60-2016-03-25 20:00:39 +0100 - 6c63877 - one last cleaning in the conf file with shellcheck
61-2016-03-25 19:47:29 +0100 - 3797960 - massive cleaning with shellcheck: from 5 errors and 200 warnings to zero
62-2016-03-24 21:12:17 +0100 - 454d278 - minor changes to the pull request before merging
63-2016-03-24 20:59:42 +0100 - 471cc9f - minor changes to the pull request before merging
64-2016-03-16 18:01:49 +0530 - 491b045 - Add storage class option for AWS S3 to specify storage class to be used
65-2016-02-26 14:56:31 +0800 - 3eabe0d - Add config sample for Slack notifications
66-2016-02-26 14:54:34 +0800 - fcfa9ac - Add Slack incoming webhook notifications support
67-2016-02-26 14:44:46 +0800 - 4fca444 - Better comment
68-2016-01-27 10:50:15 -0500 - ff1e827 - Adding support for custom mail scripts.
69-2016-01-23 15:12:03 +1100 - 931fe9e - added ftps and ftpes to list of possible destinations
70-2015-10-19 13:59:34 +0800 - 423a1d3 - Fix typo
71-2015-10-10 13:31:12 +0200 - 3a48d5a - Fix bug #106 (unary operator expected)
72-2015-10-08 10:15:56 +0200 - e5d5785 - also send email on cleanup failure + replace introduced tabs with spaces
73diff --git a/README.md b/README.md
74index 331304c605f7b68d376249e866d7204176fe0271..cc33e0863a225e98813c33249b07d528b29d2f36 100644
75--- a/README.md
76+++ b/README.md
77@@ -1,5 +1,10 @@
78 # duplicity-backup.sh
79
80+This is a personal fork of [zertrin's original script](https://github.com/zertrin/duplicity-backup.sh) with a lot of features
81+removed and streamlined for my personal use. I recommend checking out the original version for your own needs.
82+
83+## Original README
84+
85diff --git a/duplicity-backup.conf.example b/duplicity-backup.conf.example
86index 5e73f9ea595282fd48b8c033ae69868eb320bbda..91b6747512c29b88d931d96f763cca528031ee43 100644
87--- a/duplicity-backup.conf.example
88+++ b/duplicity-backup.conf.example
89@@ -112,9 +112,6 @@ DEST="s3+http://foobar-backup-bucket/backup-folder/"
90 #DEST="file:///home/foobar_user_name/new-backup-test/"
91 #DEST="imap[s]://user[:password]@host.com[/from_address_prefix]"
92 #DEST="webdav[s]://user[:password]@other.host[:port]/some_dir"
93-#DEST="gdocs://foobar_google_account/some_dir"
94-#DEST="swift://foobar_swift_container/some_dir"
95-#DEST="dpbx:///foobar_swift_container/some_dir"
96 #DEST="b2://some_account_id[:some_application_key]@some_bucket_name/some_dir"
97
98
99@@ -122,14 +119,14 @@ DEST="s3+http://foobar-backup-bucket/backup-folder/"
100 # DESTINATION BACKEND PASSWORD
101 # ------------------------------------------------------------------------------
102 # Instead of setting the password needed for the backup destination in the
103-# DEST url, you can supply it in the FTP_PASSWORD variable below, which is
104+# DEST url, you can supply it in the BACKEND_PASSWORD variable below, which is
105 # used by most, if not all backends, regardless of its name.
106 # Duplicity's official documentation states:
107 # "Supported by most backends which are password capable. More secure than
108 # setting it in the backend url (which might be readable in the operating
109 # systems process listing to other users on the same machine)."
110 #
111-#FTP_PASSWORD='password'
112+#BACKEND_PASSWORD='password'
113
114
115 # ------------------------------------------------------------------------------
116@@ -141,9 +138,9 @@ DEST="s3+http://foobar-backup-bucket/backup-folder/"
117 #AWS_SECRET_ACCESS_KEY="foobar_aws_access_key"
118 #
119 # SET STORAGE CLASS for AWS
120-# The default storage class is STANDARD STORAGE. You can comment this option if
121+# The default storage class is STANDARD STORAGE. You can comment this option if
122 # want to go with standard. The other storage options are --s3-use-ia and --s3-use-rrs.
123-# Note: --s3-use-ia option is supported only in duplicity version greater than 0.7.06
124+# Note: --s3-use-ia option is supported only in duplicity version greater than 0.7.06
125 #
126 #STORAGECLASS="--s3-use-ia"
127 #
128@@ -156,34 +153,6 @@ DEST="s3+http://foobar-backup-bucket/backup-folder/"
129 #
130 #S3CMD_CONF_FILE='/path/to/your/s3cmd/conf/file'
131
132-# ------------------------------------------------------------------------------
133-# GOOGLE CLOUD STORAGE INFORMATION
134-# ------------------------------------------------------------------------------
135-# Uncomment these lines if you're using Google Cloud storage
136-#
137-#GS_ACCESS_KEY_ID="foobar_gcs_key_id"
138-#GS_SECRET_ACCESS_KEY="foobar_gcs_secret_id"
139-
140-# ------------------------------------------------------------------------------
141-# OPENSTACK OBJECT STORAGE (SWIFT) INFORMATION
142-# ------------------------------------------------------------------------------
143-# Uncomment these lines if you're using OpenStack Object Storage (Swift)
144-#
145-#SWIFT_USERNAME="foobar_swift_tenant:foobar_swift_username"
146-#SWIFT_PASSWORD="foobar_swift_password"
147-#SWIFT_AUTHURL="foobar_swift_authurl"
148-#SWIFT_AUTHVERSION="2"
149-#SWIFT_TENANTNAME="foobar_swift_tenant"
150-#SWIFT_REGIONNAME="foobar_swift_region"
151-
152-# ------------------------------------------------------------------------------
153-# DROPBOX INFORMATION
154-# ------------------------------------------------------------------------------
155-# Uncomment these lines if you're using Dropbox
156-#
157-#DPBX_ACCESS_TOKEN="foobar_dropbox_access_token"
158-
159-
160 # ------------------------------------------------------------------------------
161 # INCLUDE LIST OF DIRECTORIES
162 # ------------------------------------------------------------------------------
163@@ -252,7 +221,7 @@ EXCLIST=( '/home/foobar_user_name/Documents/foobar-to-exclude' )
164 # Exclude all device files. This can be useful for security/permissions reasons
165 # or if device files are not handled correctly.
166 #
167-#EXDEVICEFILES=1
168+EXDEVICEFILES=1
169
170
171 # ------------------------------------------------------------------------------
172@@ -376,7 +345,6 @@ CLEAN_UP_VARIABLE="4"
173
174 LOGDIR="/home/foobar_user_name/logs/test2/"
175 LOG_FILE="duplicity-$(date +%Y-%m-%d_%H-%M).txt"
176-LOG_FILE_OWNER="foobar_user_name:foobar_user_name"
177
178 # Note that if the configured LOGDIR does not exist it will be created
179 # and its owner:group set to that of the configured LOG_FILE_OWNER.
180@@ -433,22 +401,6 @@ MAIL="mailx" # default command for Linux mail
181 NOTIFICATION_SERVICE=""
182 NOTIFICATION_FAILURE_ONLY="yes" # send notifications only if there was an error while creating backup
183
184-# Provider: Slack
185-SLACK_HOOK_URL="https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
186-SLACK_CHANNEL="#general"
187-SLACK_USERNAME="duplicity-backup"
188-SLACK_EMOJI="package"
189diff --git a/duplicity-backup.sh b/duplicity-backup.sh
190index 94bb7d838a5197c4073f51df503b4966b909a0ed..c4ae26a5446074185678503efeff85c5628981f2 100755
191--- a/duplicity-backup.sh
192+++ b/duplicity-backup.sh
193@@ -3,6 +3,7 @@
194 # Copyright (c) 2008-2010 Damon Timm.
195 # Copyright (c) 2010 Mario Santagiuliana.
196 # Copyright (c) 2012-2018 Marc Gallet.
197+# Copyright (c) 2021 TheEdgeOfRage
198 #
199 # This program is free software: you can redistribute it and/or modify it under
200 # the terms of the GNU General Public License as published by the Free Software
201@@ -17,35 +18,9 @@
202 # You should have received a copy of the GNU General Public License along with
203 # this program. If not, see <http://www.gnu.org/licenses/>.
204 #
205-# MORE ABOUT THIS SCRIPT AVAILABLE IN THE README AND AT:
206-#
207-# http://zertrin.org/projects/duplicity-backup/ (for this version)
208-# http://damontimm.com/code/dt-s3-backup (for the original program by Damon Timm)
209-#
210-# Latest code available at:
211-# http://github.com/zertrin/duplicity-backup.sh
212-#
213-# List of contributors:
214-# https://github.com/zertrin/duplicity-backup.sh/graphs/contributors
215-#
216 # ---------------------------------------------------------------------------- #
217
218-# Default config file (don't forget to copy duplicity-backup.conf.example to
219-# match that path)
220-#
221-# NOTE: It is RECOMMENDED to use the command line option -c to specify the
222-# location of the config file. The CONFIG variable here is only used for
223-# fallback purposes (look for the file named 'duplicity-backup.conf' in
224-# the same folder as the script, if the option -c is not given).
225-# It is DEPRECATED to edit this.
226-
227-CONFIG="duplicity-backup.conf"
228-
229-##############################################################
230-# Script Happens Below This Line - Shouldn't Require Editing #
231-##############################################################
232-
233-DBSH_VERSION="v1.6.0"
234+DBSH_VERSION="v1.7.0"
235
236 # make a backup of stdout and stderr for later
237 exec 6>&1
238@@ -112,27 +87,6 @@ fi
239 DUPLICITY_VERSION=$(${DUPLICITY} --version)
240 DUPLICITY_VERSION=${DUPLICITY_VERSION//[^0-9\.]/}
241
242-version_compare() {
243- if [[ $1 =~ ^([0-9]+\.?)+$ && $2 =~ ^([0-9]+\.?)+$ ]]; then
244- # shellcheck disable=SC2206
245- local l=(${1//./ }) r=(${2//./ }) s=${#l[@]}; [[ ${#r[@]} -gt ${#l[@]} ]] && s=${#r[@]}
246-
247- for i in $(seq 0 $((s - 1))); do
248- [[ ${l[$i]} -gt ${r[$i]} ]] && return 1
249- [[ ${l[$i]} -lt ${r[$i]} ]] && return 2
250- done
251-
252- return 0
253- else
254- echo "Invalid version number given"
255- exit 1
256- fi
257-}
258-
259-# set a flag if duplicity's version is lower than 0.7, for usage later in the script
260-version_compare "${DUPLICITY_VERSION}" 0.7
261-case $? in 2) LT07=1;; *) LT07=0;; esac
262-
263 version(){
264 echo "duplicity-backup.sh ${DBSH_VERSION}"
265 echo "duplicity ${DUPLICITY_VERSION}"
266@@ -241,9 +195,16 @@ done
267
268 # ---------------- Read config file if specified -----------------
269
270+if [ -z "${CONFIG}" ];
271+then
272+ echo "ERROR: set config file destination with CONFIG env var or -c file flag" >&2
273+ usage
274+ exit 1
275+fi
276+
277 if [ -n "${CONFIG}" ] && [ -f "${CONFIG}" ];
278 then
279- # shellcheck source=duplicity-backup.conf.example
280+ # shellcheck disable=SC1090
281 . "${CONFIG}"
282 else
283 echo "ERROR: can't find config file! (${CONFIG})" >&2
284@@ -255,11 +216,11 @@ fi
285
286 # Setup logging as soon as possible, in order to be able to perform i/o redirection
287
288-[[ ${LOGDIR} = "/home/foobar_user_name/logs/test2/" ]] && config_sanity_fail "LOGDIR must be configured"
289+LOGDIR=${LOGDIR:-"${HOME}/.local/log/duplicity/"}
290+LOG_FILE=${LOGDIR:-"duplicity-$(date +%Y-%m-%dT%H:%M:%S).log"}
291
292 # Ensure a trailing slash always exists in the log directory name