taperole 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -0
  3. data/CONTRIBUTING.md +8 -0
  4. data/README.md +33 -4
  5. data/Rakefile +6 -0
  6. data/Vagrantfile +6 -7
  7. data/bin/tape +2 -89
  8. data/lib/taperole/commands/ansible.rb +56 -0
  9. data/lib/taperole/commands/installer.rb +19 -0
  10. data/lib/taperole/commands/tape.rb +32 -0
  11. data/lib/taperole/core/ansible_runner.rb +86 -0
  12. data/lib/taperole/core/installer.rb +87 -0
  13. data/lib/taperole/core/notifier.rb +47 -0
  14. data/lib/taperole/helpers/files.rb +76 -0
  15. data/lib/taperole/helpers/logging.rb +37 -0
  16. data/lib/taperole/notifiers/slack.rb +83 -0
  17. data/lib/taperole/version.rb +3 -0
  18. data/lib/taperole.rb +24 -0
  19. data/requirements.yml +1 -1
  20. data/roles/backend_checkout/tasks/main.yml +1 -0
  21. data/roles/delayed_job/tasks/main.yml +0 -15
  22. data/roles/deployer_user/tasks/keys.yml +6 -6
  23. data/roles/deployer_user/tasks/main.yml +0 -3
  24. data/roles/monit_install/tasks/main.yml +6 -0
  25. data/roles/monit_install/templates/monitrc.j2 +290 -0
  26. data/roles/nginx/tasks/main.yml +3 -4
  27. data/roles/nginx/templates/nginx_unicorn.j2 +1 -0
  28. data/roles/node/tasks/main.yml +2 -1
  29. data/roles/ruby/tasks/main.yml +3 -11
  30. data/roles/unicorn_install/tasks/main.yml +0 -3
  31. data/roles/unicorn_install/templates/unicorn.rb.j2 +1 -1
  32. data/roles/unicorn_install/templates/unicorn_init.j2 +1 -1
  33. data/roles/unicorn_install/templates/unicorn_monit.j2 +1 -1
  34. data/spec/commands/installer_spec.rb +117 -0
  35. data/spec/spec_helper.rb +24 -0
  36. data/taperole.gemspec +8 -1
  37. data/templates/base/deploy.example.yml +1 -0
  38. data/templates/base/hosts.example +1 -1
  39. data/templates/base/omnibox.example.yml +15 -0
  40. data/templates/base/rake.example.yml +18 -0
  41. data/templates/base/tape_vars.example.yml +9 -8
  42. data/templates/static_html/omnibox.example.yml +13 -0
  43. data/test/base_docker_box/Dockerfile +1 -1
  44. data/test/rails/Dockerfile +3 -3
  45. data/test/rails/start_rails.sh +1 -0
  46. data/test/rails/tape_vars.yml +2 -2
  47. data/vendor/ANXS.postgresql/.travis.yml +27 -12
  48. data/vendor/ANXS.postgresql/README.md +1 -1
  49. data/vendor/ANXS.postgresql/Vagrantfile +7 -2
  50. data/vendor/ANXS.postgresql/meta/.galaxy_install_info +1 -1
  51. data/vendor/ANXS.postgresql/meta/main.yml +1 -1
  52. data/vendor/ANXS.postgresql/tasks/configure.yml +10 -10
  53. data/vendor/ANXS.postgresql/tasks/databases.yml +27 -27
  54. data/vendor/ANXS.postgresql/tasks/install_yum.yml +2 -2
  55. data/vendor/ANXS.postgresql/tasks/users.yml +4 -4
  56. data/vendor/ANXS.postgresql/tasks/users_privileges.yml +3 -3
  57. data/vendor/ANXS.postgresql/tests/Dockerfile-centos6 +20 -0
  58. data/vendor/ANXS.postgresql/tests/Dockerfile-ubuntu14.04 +17 -0
  59. data/vendor/ANXS.postgresql/tests/playbook.yml +1 -1
  60. data/vendor/ANXS.postgresql/tests/vars.yml +2 -0
  61. data/vendor/Stouts.backup/.bumpversion.cfg +1 -1
  62. data/vendor/Stouts.backup/.travis.yml +0 -1
  63. data/vendor/Stouts.backup/CONTRIBUTORS +2 -0
  64. data/vendor/Stouts.backup/README.md +1 -0
  65. data/vendor/Stouts.backup/defaults/main.yml +3 -3
  66. data/vendor/Stouts.backup/meta/.galaxy_install_info +1 -1
  67. data/vendor/Stouts.backup/runtests.sh +65 -0
  68. data/vendor/Stouts.backup/tasks/backup.yml +3 -0
  69. data/vendor/Stouts.backup/tasks/configure.yml +13 -12
  70. data/vendor/Stouts.backup/tasks/install.deb.yml +6 -8
  71. data/vendor/Stouts.backup/tasks/install.red.yml +28 -0
  72. data/vendor/Stouts.backup/tasks/remove.yml +3 -3
  73. data/vendor/Stouts.backup/templates/cron.j2 +1 -1
  74. data/vendor/Stouts.backup/templates/duply.sh.j2 +219 -218
  75. data/vendor/Stouts.backup/templates/pre.j2 +6 -0
  76. data/vendor/Stouts.backup/templates/restore.j2 +6 -0
  77. data/vendor/Stouts.backup/vars/Debian.yml +3 -0
  78. data/vendor/Stouts.backup/vars/Ubuntu.yml +1 -0
  79. metadata +67 -10
  80. data/lib/tape/ansible_runner.rb +0 -130
  81. data/lib/tape/info.rb +0 -9
  82. data/lib/tape/installer.rb +0 -160
  83. data/lib/tape/notifiers/slack.rb +0 -79
  84. data/lib/tape/overwriter.rb +0 -14
  85. data/lib/tape/qemu_provisioner.rb +0 -167
  86. data/lib/tape.rb +0 -127
@@ -17,13 +17,13 @@
17
17
  ###############################################################################
18
18
  # TODO/IDEAS/KNOWN PROBLEMS:
19
19
  # - possibility to restore time frames (incl. deleted files)
20
- # realizable by listing each backup and restore from
20
+ # realizable by listing each backup and restore from
21
21
  # oldest to the newest, problem: not performant
22
22
  # - search file in all backups function and show available
23
23
  # versions with backups date (list old avail since 0.6.06)
24
- # - edit profile opens conf file in vi
24
+ # - edit profile opens conf file in vi
25
25
  # - implement log-fd interpretation
26
- # - add a duplicity option check against the options pending
26
+ # - add a duplicity option check against the options pending
27
27
  # deprecation since 0.5.10 namely --time-separator
28
28
  # --short-filenames
29
29
  # --old-filenames
@@ -40,7 +40,7 @@
40
40
  #
41
41
  # 1.9.0 (24.8.2014)
42
42
  # - bugfix: env vars were not exported when external script was executable
43
- # - rework GPG_KEY handling, allow virtually anything now (uid, keyid etc.)
43
+ # - rework GPG_KEY handling, allow virtually anything now (uid, keyid etc.)
44
44
  # see gpg manpage, section "How to specify a user ID"
45
45
  # let gpg complain when the delivered values are invalid for whatever reason
46
46
  # - started to rework tmp space checking, exposed folder & writable check
@@ -49,7 +49,7 @@
49
49
  # 1.8.0 (13.7.2014)
50
50
  # - add command verifyPath to expose 'verify --file-to-restore' action
51
51
  # - add time parameter support to verify command
52
- # - add section time formats to usage output
52
+ # - add section time formats to usage output
53
53
  #
54
54
  # 1.7.4 (24.6.2014)
55
55
  # - remove ubuntu one support, service is discontinued
@@ -59,23 +59,23 @@
59
59
  # - bugfix: test routines, gpg2 asked for passphrase although GPG_PW was set
60
60
  #
61
61
  # 1.7.2 (1.4.2014 "April,April")
62
- # - bugfix: debian Bug#743190 "duply no longer allows restoration without
62
+ # - bugfix: debian Bug#743190 "duply no longer allows restoration without
63
63
  # gpg passphrase in conf file"
64
64
  # GPG_AGENT_INFO env var is now needed to trigger --use-agent
65
65
  # - bugfix: gpg keyenc test routines didn't work if GPG_PW was not set
66
66
  #
67
67
  # 1.7.1 (30.3.2014)
68
- # - bugfix: purge-* commands renamed to purgeFull, purgeIncr due to
69
- # incompatibility with new minus batch separator
68
+ # - bugfix: purge-* commands renamed to purgeFull, purgeIncr due to
69
+ # incompatibility with new minus batch separator
70
70
  #
71
71
  # 1.7.0 (20.3.2014)
72
72
  # - disabled gpg key id plausibility check, too many valid possibilities
73
73
  # - featreq 7 "Halt if precondition fails":
74
74
  # added and(+), or(-) batch command(separator) support
75
- # - featreq 26 "pre/post script with shebang line":
76
- # if a script is flagged executable it's executed in a subshell
75
+ # - featreq 26 "pre/post script with shebang line":
76
+ # if a script is flagged executable it's executed in a subshell
77
77
  # now as opposed to sourced to bash, which is the default
78
- # - bugfix: do not check if dpbx, swift credentials are set anymore
78
+ # - bugfix: do not check if dpbx, swift credentials are set anymore
79
79
  # - bugfix: properly escape profile name, archdir if used as arguments
80
80
  # - add DUPL_PRECMD conf setting for use with e.g. trickle
81
81
  #
@@ -88,7 +88,7 @@
88
88
  # homedir can thus be configured to be located anywhere
89
89
  # - always import both secret and public key if avail from config profile
90
90
  # - new explanatory comments in initial exclude file
91
- # - bugfix 7: Duply only imports one key at a time
91
+ # - bugfix 7: Duply only imports one key at a time
92
92
  #
93
93
  # 1.5.11 (19.07.2013)
94
94
  # - purge-incr command for remove-all-inc-of-but-n-full feature added
@@ -103,7 +103,7 @@
103
103
  #
104
104
  # 1.5.9 (22.11.2012)
105
105
  # - bugfix 3588926: filter --exclude* params for restore/fetch ate too much
106
- # - restore/fetch now also ignores --include* or --exclude='foobar'
106
+ # - restore/fetch now also ignores --include* or --exclude='foobar'
107
107
  #
108
108
  # 1.5.8 (26.10.2012)
109
109
  # - bugfix 3575487: implement proper cloud files support
@@ -112,7 +112,7 @@
112
112
  # - bugfix 3531450: Cannot use space in target URL (file:///) anymore
113
113
  #
114
114
  # 1.5.6 (24.5.2012)
115
- # - commands purge, purge-full have no default value anymore for security
115
+ # - commands purge, purge-full have no default value anymore for security
116
116
  # reasons; instead max value can be given via cmd line or must be set
117
117
  # in profile; else an error is shown.
118
118
  # - minor man page modifications
@@ -143,33 +143,33 @@
143
143
  # - bugfix 3312208: signing detection broke symmetric gpg test routine
144
144
  #
145
145
  # 1.5.5 (2.5.2011)
146
- # - bugfix: fetch problem with space char in path, escape all params
146
+ # - bugfix: fetch problem with space char in path, escape all params
147
147
  # containing non word chars
148
148
  # - list available profiles, if given profile cannot be found
149
149
  # - added --use-agent configuration hint
150
- # - bugfix 3174133: --exclude* params in conf DUPL_PARAMS broke
150
+ # - bugfix 3174133: --exclude* params in conf DUPL_PARAMS broke
151
151
  # fetch/restore
152
152
  # - version command now prints out 'using installed' info
153
- # - featreq 3166169: autotrust imported keys, based on code submitted by
154
- # Martin Ellis - imported keys are now automagically trusted ultimately
153
+ # - featreq 3166169: autotrust imported keys, based on code submitted by
154
+ # Martin Ellis - imported keys are now automagically trusted ultimately
155
155
  # - new txt2man feature to create manpages for package maintainers
156
156
  #
157
157
  # 1.5.4.2 (6.1.2011)
158
158
  # - new command changelog
159
159
  # - bugfix 3109884: freebsd awk segfaulted on printf '%*', use print again
160
- # - bugfix: freebsd awk hangs on 'awk -W version'
160
+ # - bugfix: freebsd awk hangs on 'awk -W version'
161
161
  # - bugfix 3150244: mawk does not know '--version'
162
162
  # - minor help text improvements
163
163
  # - new env vars CMD_PREV,CMD_NEXT replacing CMD env var for scripts
164
164
  #
165
165
  # 1.5.4.1 (4.12.2010)
166
166
  # - output awk, python, bash version now in prolog
167
- # - shebang uses /usr/bin/env now for freebsd compatibility,
168
- # bash not in /bin/bash
169
- # - new --disable-encryption parameter,
167
+ # - shebang uses /usr/bin/env now for freebsd compatibility,
168
+ # bash not in /bin/bash
169
+ # - new --disable-encryption parameter,
170
170
  # to override profile encr settings for one run
171
171
  # - added exclude-if-present setting to conf template
172
- # - bug 3126972: GPG_PW only needed for signing/symmetric encryption
172
+ # - bug 3126972: GPG_PW only needed for signing/symmetric encryption
173
173
  # (even though duplicity still needs it)
174
174
  #
175
175
  # 1.5.4 (15.11.2010)
@@ -186,8 +186,8 @@
186
186
  # - bugfix 2996459: Duply erroneously escapes '-' symbol in username
187
187
  # - url_encode function is now pythonized
188
188
  # - rsync uses FTP_PASSWORD now if duplicity 0.6.10+ , else issue warning
189
- # - feature 3059262: Make pre and post aware of parameters,
190
- # internal parameters + CMD of pre or post
189
+ # - feature 3059262: Make pre and post aware of parameters,
190
+ # internal parameters + CMD of pre or post
191
191
  #
192
192
  # 1.5.2.3 (16.4.2010)
193
193
  # - bugfix: date again, should now work virtually anywhere
@@ -234,15 +234,15 @@
234
234
  # aid=2864410&group_id=217745&atid=1041147
235
235
  #
236
236
  # 1.5.1 (21.09.2009) - duply (fka. ftplicity)
237
- # - first things first: ftplicity (being able to support all backends since
237
+ # - first things first: ftplicity (being able to support all backends since
238
238
  # some time) will be called duply (fka. ftplicity) from now on. The addendum
239
239
  # is for the time being to circumvent confusion.
240
- # - bugfix: exit code is 1 (error) not 0 (success), if at least on duplicity
240
+ # - bugfix: exit code is 1 (error) not 0 (success), if at least on duplicity
241
241
  # command failed
242
242
  # - s3[+http] now supported natively by translating user/pass to access_key/
243
- # secret_key environment variables needed by duplicity s3 boto backend
243
+ # secret_key environment variables needed by duplicity s3 boto backend
244
244
  # - bugfix: additional output lines do not confuse version check anymore
245
- # - list command supports now age parameter (patch by stefan on feature
245
+ # - list command supports now age parameter (patch by stefan on feature
246
246
  # request tracker)
247
247
  # - bugfix: option/param pairs are now correctly passed on to duplicity
248
248
  # - bugfix: s3[+http] needs no TARGET_PASS if command is read only
@@ -259,7 +259,7 @@
259
259
  #
260
260
  # 1.5.0 (01.07.2009)
261
261
  # - removed ftp limitation, all duplicity backends should work now
262
- # - bugfix: date for separator failed on openwrt busybox date, added a
262
+ # - bugfix: date for separator failed on openwrt busybox date, added a
263
263
  # detecting workaround, milliseconds are not available w/ busybox date
264
264
  #
265
265
  # 1.4.2.1 (14.05.2009)
@@ -268,29 +268,29 @@
268
268
  # 1.4.2 (22.04.2009)
269
269
  # - gpg keys are now exported as gpgkey.[id].asc , the suffix reflects the
270
270
  # armored ascii nature, the id helps if the key is switched for some reason
271
- # im/export routines are updated accordingly (import is backward compatible
272
- # to the old profile/gpgkey files)
273
- # - profile argument is treated as path if it contains slashes
271
+ # im/export routines are updated accordingly (import is backward compatible
272
+ # to the old profile/gpgkey files)
273
+ # - profile argument is treated as path if it contains slashes
274
274
  # (for details see usage)
275
- # - non-ftplicity options (all but --preview currently) are now passed
276
- # on to duplicity
275
+ # - non-ftplicity options (all but --preview currently) are now passed
276
+ # on to duplicity
277
277
  # - removed need for stat in secure_conf, it is ls based now
278
278
  # - added profile folder readable check
279
279
  # - added gpg version & home info output
280
280
  # - awk utility availability is now checked, because it was mandatory already
281
281
  # - tmp space is now checked on writability and space requirement
282
- # test fails on less than 25MB or configured $VOLSIZE,
283
- # test warns if there is less than two times $VOLSIZE because
284
- # that's required for --asynchronous-upload option
285
- # - gpg functionality is tested now before executing duplicity
282
+ # test fails on less than 25MB or configured $VOLSIZE,
283
+ # test warns if there is less than two times $VOLSIZE because
284
+ # that's required for --asynchronous-upload option
285
+ # - gpg functionality is tested now before executing duplicity
286
286
  # test drive contains encryption, decryption, comparison, cleanup
287
287
  # this is meant to detect non trusted or other gpg errors early
288
288
  # - added possibility of doing symmetric encryption with duplicity
289
289
  # set GPG_KEY="" or simply comment it out
290
- # - added hints in config template on the depreciation of
290
+ # - added hints in config template on the depreciation of
291
291
  # --short-filenames, --time-separator duplicity options
292
292
  #
293
- # new versioning scheme 1.4.2b => 1.4.2,
293
+ # new versioning scheme 1.4.2b => 1.4.2,
294
294
  # beta b's are replaced by a patch count number e.g. 1.4.2.1 will be assigned
295
295
  # to the first bug fixing version and 1.4.2.2 to the second and so on
296
296
  # also the releases will now have a release date formatted (Day.Month.Year)
@@ -311,26 +311,26 @@
311
311
  #
312
312
  # 1.4.0b1 - bugfix: incr forces incremental backups on duplicity,
313
313
  # therefore backup translates to pre_bkp_post now
314
- # - bugfix: new command bkp, which represents duplicity's
314
+ # - bugfix: new command bkp, which represents duplicity's
315
315
  # default action (incr or full if full_if_older matches
316
316
  # or no earlier backup chain is found)
317
317
  #
318
318
  # new versioning scheme 1.4 => 1.4.0, added new minor revision number
319
- # this is meant to slow down the rapid version growing but still keep
319
+ # this is meant to slow down the rapid version growing but still keep
320
320
  # versions cleanly separated.
321
- # only additional features will raise the new minor revision number.
322
- # all releases start as beta, each bugfix release will raise the beta
321
+ # only additional features will raise the new minor revision number.
322
+ # all releases start as beta, each bugfix release will raise the beta
323
323
  # count, usually new features arrive before a version 'ripes' to stable
324
- #
324
+ #
325
325
  # 1.4.0b
326
326
  # 1.4b - added startup info on version, time, selected profile
327
327
  # - added time output to separation lines
328
- # - introduced: command purge-full implements duplicity's
328
+ # - introduced: command purge-full implements duplicity's
329
329
  # remove-all-but-n-full functionality (patch by unknown),
330
330
  # uses config variable $MAX_FULL_BACKUPS (default = 1)
331
- # - purge config var $MAX_AGE defaults to 1M (month) now
331
+ # - purge config var $MAX_AGE defaults to 1M (month) now
332
332
  # - command full does not execute pre/post anymore
333
- # use batch command pre_full_post if needed
333
+ # use batch command pre_full_post if needed
334
334
  # - introduced batch mode cmd1_cmd2_etc
335
335
  # (in turn removed the bvp command)
336
336
  # - unknown/undefined command issues a warning/error now
@@ -338,13 +338,13 @@
338
338
  # 1.3b3 - introduced pre/post commands to execute/debug scripts
339
339
  # - introduced bvp (backup, verify, purge)
340
340
  # - bugfix: removed need for awk gensub, now mawk compatible
341
- # 1.3b2 - removed pre/post need executable bit set
341
+ # 1.3b2 - removed pre/post need executable bit set
342
342
  # - profiles now under ~/.ftplicity as folders
343
343
  # - root can keep profiles in /etc/ftplicity, folder must be
344
344
  # created by hand, existing profiles must be moved there
345
345
  # - removed ftplicity in path requirement
346
346
  # - bugfix: bash < v.3 did not know '=~'
347
- # - bugfix: purge works again
347
+ # - bugfix: purge works again
348
348
  # 1.3 - introduces multiple profiles support
349
349
  # - modified some script errors/docs
350
350
  # - reordered gpg key check import routine
@@ -352,9 +352,9 @@
352
352
  # - added error_gpg (adds how to setup gpg key howto)
353
353
  # - bugfix: duplicity 0.4.4RC4+ parameter syntax changed
354
354
  # - duplicity_version_check routine introduced
355
- # - added time separator, shortnames, volsize, full_if_older
356
- # duplicity options to config file (inspired by stevie
357
- # from http://weareroot.de)
355
+ # - added time separator, shortnames, volsize, full_if_older
356
+ # duplicity options to config file (inspired by stevie
357
+ # from http://weareroot.de)
358
358
  # 1.1.1 - bugfix: encryption reactivated
359
359
  # 1.1 - introduced config directory
360
360
  # 1.0 - first release
@@ -385,11 +385,11 @@ function set_config { # sets config vars
385
385
  local CONFHOME="{{backup_home}}"
386
386
 
387
387
  # confdir can be delivered as path (must contain /)
388
- if [ `echo $FTPLCFG | grep /` ] ; then
388
+ if [ `echo $FTPLCFG | grep /` ] ; then
389
389
  CONFDIR=$(readlink -f $FTPLCFG 2>/dev/null || \
390
390
  ( echo $FTPLCFG|grep -v '^/' 1>/dev/null 2>&1 \
391
391
  && echo $(pwd)/${FTPLCFG} ) || \
392
- echo ${FTPLCFG})
392
+ echo ${FTPLCFG})
393
393
  # or DEFAULT in home/.duply folder (NEW)
394
394
  elif [ -d "${CONFHOME}" ]; then
395
395
  CONFDIR="${CONFHOME}/${FTPLCFG}"
@@ -417,7 +417,7 @@ function set_config { # sets config vars
417
417
  POST="$CONFDIR/post"
418
418
  EXCLUDE="$CONFDIR/exclude"
419
419
  KEYFILE="$CONFDIR/gpgkey.asc"
420
-
420
+
421
421
  }
422
422
 
423
423
  {% raw %}
@@ -429,7 +429,7 @@ function version_info { # print version information
429
429
  END
430
430
  }
431
431
 
432
- function version_info_using {
432
+ function version_info_using {
433
433
  cat <<END
434
434
  $(version_info)
435
435
 
@@ -453,8 +453,8 @@ function usage_info { # print usage information
453
453
  cat <<USAGE_EOF
454
454
  VERSION:
455
455
  $(version_info)
456
-
457
- DESCRIPTION:
456
+
457
+ DESCRIPTION:
458
458
  Duply deals as a wrapper for the mighty duplicity magic.
459
459
  It simplifies running duplicity with cron or on command line by:
460
460
 
@@ -466,15 +466,15 @@ DESCRIPTION:
466
466
  For each backup job one configuration profile must be created.
467
467
  The profile folder will be stored under '~/.${ME_NAME}/<profile>'
468
468
  (where ~ is the current users home directory).
469
- Hint:
469
+ Hint:
470
470
  If the folder '/etc/${ME_NAME}' exists, the profiles for the super
471
471
  user root will be searched & created there.
472
472
 
473
473
  USAGE:
474
- first time usage (profile creation):
474
+ first time usage (profile creation):
475
475
  $ME <profile> create
476
476
 
477
- general usage in single or batch mode (see EXAMPLES):
477
+ general usage in single or batch mode (see EXAMPLES):
478
478
  $ME <profile> <command>[[_|+|-]<command>[_|+|-]...] [<options> ...]
479
479
 
480
480
  For batches the conditional separators can also be written as pseudo commands
@@ -484,36 +484,36 @@ USAGE:
484
484
  All conf parameters can also be defined in the environment instead.
485
485
 
486
486
  PROFILE:
487
- Indicated by a path or a profile name (<profile>), which is resolved
487
+ Indicated by a path or a profile name (<profile>), which is resolved
488
488
  to '~/.${ME_NAME}/<profile>' (~ expands to environment variable \$HOME).
489
489
 
490
490
  Superuser root can place profiles under '/etc/${ME_NAME}'. Simply create
491
491
  the folder manually before running $ME as superuser.
492
- Note:
492
+ Note:
493
493
  Already existing profiles in root's profile folder will cease to work
494
494
  unless there are moved to the new location manually.
495
495
 
496
496
  example 1: $ME humbug backup
497
497
 
498
- Alternatively a _path_ might be used e.g. useful for quick testing,
498
+ Alternatively a _path_ might be used e.g. useful for quick testing,
499
499
  restoring or exotic locations. Shell expansion should work as usual.
500
- Hint:
501
- The path must contain at least one path separator '/',
500
+ Hint:
501
+ The path must contain at least one path separator '/',
502
502
  e.g. './test' instead of only 'test'.
503
503
 
504
504
  example 2: $ME ~/.${ME_NAME}/humbug backup
505
505
 
506
506
  SEPARATORS:
507
- _ (underscore)
507
+ _ (underscore)
508
508
  neutral separator
509
- + (plus sign), _and_
509
+ + (plus sign), _and_
510
510
  conditional AND
511
511
  the next command will only be executed if the previous succeeded
512
- - (minus sign), _or_
512
+ - (minus sign), _or_
513
513
  conditional OR
514
514
  the next command will only be executed if the previous failed
515
515
 
516
- example:
516
+ example:
517
517
  'pre+bkp-verify_post' translates to 'pre_and_bkp_or_verify_post'
518
518
 
519
519
  COMMANDS:
@@ -528,45 +528,45 @@ COMMANDS:
528
528
  bkp as above but without executing pre/post scripts
529
529
  full force full backup
530
530
  incr force incremental backup
531
- list [<age>]
531
+ list [<age>]
532
532
  list all files in backup (as it was at <age>, default: now)
533
533
  status prints backup sets and chains currently in repository
534
- verify [<age>] [--compare-data]
534
+ verify [<age>] [--compare-data]
535
535
  list files changed, since age if given
536
- verifyPath <rel_path_in_bkp> <local_path> [<age>] [--compare-data]
536
+ verifyPath <rel_path_in_bkp> <local_path> [<age>] [--compare-data]
537
537
  list changes of a file or folder path in backup compared to a
538
538
  local path, since age if given
539
- restore <target_path> [<age>]
539
+ restore <target_path> [<age>]
540
540
  restore the complete backup to <target_path> [as it was at <age>]
541
- fetch <src_path> <target_path> [<age>]
541
+ fetch <src_path> <target_path> [<age>]
542
542
  fetch single file/folder from backup [as it was at <age>]
543
- purge [<max_age>] [--force]
543
+ purge [<max_age>] [--force]
544
544
  list outdated backup files (older than \$MAX_AGE)
545
545
  [use --force to actually delete these files]
546
- purgeFull [<max_full_backups>] [--force]
546
+ purgeFull [<max_full_backups>] [--force]
547
547
  list outdated backup files (\$MAX_FULL_BACKUPS being the number of
548
- full backups and associated incrementals to keep, counting in
548
+ full backups and associated incrementals to keep, counting in
549
549
  reverse chronological order)
550
550
  [use --force to actually delete these files]
551
- purgeIncr [<max_fulls_with_incrs>] [--force]
552
- list outdated incremental backups (\$MAX_FULLS_WITH_INCRS being
551
+ purgeIncr [<max_fulls_with_incrs>] [--force]
552
+ list outdated incremental backups (\$MAX_FULLS_WITH_INCRS being
553
553
  the number of full backups which associated incrementals will be
554
- kept, counting in reverse chronological order)
554
+ kept, counting in reverse chronological order)
555
555
  [use --force to actually delete these files]
556
- cleanup [--force]
556
+ cleanup [--force]
557
557
  list broken backup chain files archives (e.g. after unfinished run)
558
558
  [use --force to actually delete these files]
559
559
 
560
560
  changelog print changelog / todo list
561
- txt2man feature for package maintainers - create a manpage based on the
562
- usage output. download txt2man from http://mvertes.free.fr/, put
561
+ txt2man feature for package maintainers - create a manpage based on the
562
+ usage output. download txt2man from http://mvertes.free.fr/, put
563
563
  it in the PATH and run '$ME txt2man' to create a man page.
564
564
  version show version information of $ME and needed programs
565
565
 
566
566
  OPTIONS:
567
567
  --force passed to duplicity (see commands: purge, purge-full, cleanup)
568
568
  --preview do nothing but print out generated duplicity command lines
569
- --disable-encryption
569
+ --disable-encryption
570
570
  disable encryption, overrides profile settings
571
571
 
572
572
  TIME FORMATS:
@@ -581,30 +581,30 @@ PRE/POST SCRIPTS:
581
581
  Useful internal duply variables will be readable in the scripts.
582
582
  Some of interest may be
583
583
 
584
- CONFDIR, SOURCE, TARGET_URL_<PROT|HOSTPATH|USER|PASS>,
584
+ CONFDIR, SOURCE, TARGET_URL_<PROT|HOSTPATH|USER|PASS>,
585
585
  GPG_<KEYS_ENC|KEY_SIGN|PW>, CMD_<PREV|NEXT>, CMD_ERR
586
586
 
587
- The CMD_* variables were introduced to allow different actions according to
588
- the command the scripts were attached to e.g. 'pre_bkp_post_pre_verify_post'
589
- will call the pre script two times, with CMD_NEXT variable set to 'bkp'
587
+ The CMD_* variables were introduced to allow different actions according to
588
+ the command the scripts were attached to e.g. 'pre_bkp_post_pre_verify_post'
589
+ will call the pre script two times, with CMD_NEXT variable set to 'bkp'
590
590
  on the first and to 'verify' on the second run.
591
591
  CMD_ERR holds the exit code of the CMD_PREV .
592
592
 
593
593
  EXAMPLES:
594
- create profile 'humbug':
594
+ create profile 'humbug':
595
595
  $ME humbug create (now edit the resulting conf file)
596
- backup 'humbug' now:
596
+ backup 'humbug' now:
597
597
  $ME humbug backup
598
- list available backup sets of profile 'humbug':
598
+ list available backup sets of profile 'humbug':
599
599
  $ME humbug status
600
- list and delete obsolete backup archives of 'humbug':
600
+ list and delete obsolete backup archives of 'humbug':
601
601
  $ME humbug purge --force
602
- restore latest backup of 'humbug' to /mnt/restore:
602
+ restore latest backup of 'humbug' to /mnt/restore:
603
603
  $ME humbug restore /mnt/restore
604
- restore /etc/passwd of 'humbug' from 4 days ago to /root/pw:
604
+ restore /etc/passwd of 'humbug' from 4 days ago to /root/pw:
605
605
  $ME humbug fetch etc/passwd /root/pw 4D
606
606
  (see "duplicity manpage", section TIME FORMATS)
607
- a one line batch job on 'humbug' for cron execution:
607
+ a one line batch job on 'humbug' for cron execution:
608
608
  $ME humbug backup_verify_purge --force
609
609
 
610
610
  FILES:
@@ -655,10 +655,10 @@ GPG_PW='${DEFAULT_GPG_PW}'
655
655
  # GPG_KEYS_ENC='<keyid1>[,<keyid2>,...]' - list of pubkeys to encrypt to
656
656
  # GPG_KEY_SIGN='<keyid1>|disabled' - a secret key for signing
657
657
  # GPG_PW='<passphrase>' - needed for signing, decryption and symmetric
658
- # encryption. If you want to deliver different passphrases for e.g.
658
+ # encryption. If you want to deliver different passphrases for e.g.
659
659
  # several keys or symmetric encryption plus key signing you can use
660
660
  # gpg-agent. Simply make sure that GPG_AGENT_INFO is set in environment.
661
- # also see "A NOTE ON SYMMETRIC ENCRYPTION AND SIGNING" in duplicity manpage
661
+ # also see "A NOTE ON SYMMETRIC ENCRYPTION AND SIGNING" in duplicity manpage
662
662
  # notes on en/decryption
663
663
  # private key and passphrase will only be needed for decryption or signing.
664
664
  # decryption happens on restore and incrementals (compare archdir contents).
@@ -671,7 +671,7 @@ GPG_PW='${DEFAULT_GPG_PW}'
671
671
  #GPG_PW_SIGN='<signpass>'
672
672
 
673
673
  # gpg options passed from duplicity to gpg process (default='')
674
- # e.g. "--trust-model pgp|classic|direct|always"
674
+ # e.g. "--trust-model pgp|classic|direct|always"
675
675
  # or "--compress-algo=bzip2 --bzip2-compress-level=9"
676
676
  # or "--personal-cipher-preferences AES256,AES192,AES..."
677
677
  # or "--homedir ~/.duply" - keep keyring and gpg settings duply specific
@@ -686,7 +686,7 @@ GPG_PW='${DEFAULT_GPG_PW}'
686
686
  # for details see duplicity manpage, section URL Format
687
687
  # http://duplicity.nongnu.org/duplicity.1.html#sect8
688
688
  # probably one out of
689
- # # for cloudfiles backend user id is CLOUDFILES_USERNAME, password is
689
+ # # for cloudfiles backend user id is CLOUDFILES_USERNAME, password is
690
690
  # # CLOUDFILES_APIKEY, you might need to set CLOUDFILES_AUTHURL manually
691
691
  # cf+http://[user:password@]container_name
692
692
  # dpbx:///some_dir
@@ -695,7 +695,7 @@ GPG_PW='${DEFAULT_GPG_PW}'
695
695
  # gdocs://user[:password]@other.host/some_dir
696
696
  # # for the google cloud storage (since duplicity 0.6.22)
697
697
  # # user/password are GS_ACCESS_KEY_ID/GS_SECRET_ACCESS_KEY
698
- # gs://bucket[/prefix]
698
+ # gs://bucket[/prefix]
699
699
  # hsi://user[:password]@other.host/some_dir
700
700
  # imap[s]://user[:password]@host.com[/from_address_prefix]
701
701
  # mega://user[:password]@mega.co.nz/some_dir
@@ -708,16 +708,16 @@ GPG_PW='${DEFAULT_GPG_PW}'
708
708
  # # scp and sftp are aliases for the ssh backend
709
709
  # ssh://user[:password]@other.host[:port]/[/]some_dir
710
710
  # # for authenticated swift define TARGET_USER or SWIFT_USERNAME,
711
- # # TARGET_PASS or SWIFT_PASSWORD, SWIFT_AUTHURL (mandatory, the path to
711
+ # # TARGET_PASS or SWIFT_PASSWORD, SWIFT_AUTHURL (mandatory, the path to
712
712
  # # your identity service, omitting leads to an error with swift),
713
713
  # # optionally SWIFT_AUTHVERSION (which defaults to "1")
714
714
  # swift://container_name
715
715
  # tahoe://alias/directory
716
716
  # webdav[s]://user[:password]@other.host/some_dir
717
- # ATTENTION: characters other than A-Za-z0-9.-_.~ in the URL have
717
+ # ATTENTION: characters other than A-Za-z0-9.-_.~ in the URL have
718
718
  # to be replaced by their url encoded pendants, see
719
- # http://en.wikipedia.org/wiki/Url_encoding
720
- # if you define the credentials as TARGET_USER, TARGET_PASS below
719
+ # http://en.wikipedia.org/wiki/Url_encoding
720
+ # if you define the credentials as TARGET_USER, TARGET_PASS below
721
721
  # duply will try to url_encode them for you if the need arises
722
722
  TARGET='${DEFAULT_TARGET}'
723
723
  # optionally the username/password can be defined as extra variables
@@ -728,7 +728,7 @@ TARGET='${DEFAULT_TARGET}'
728
728
  # base directory to backup
729
729
  SOURCE='${DEFAULT_SOURCE}'
730
730
 
731
- # a command that runs duplicity e.g.
731
+ # a command that runs duplicity e.g.
732
732
  # shape bandwidth use via trickle
733
733
  # "trickle -s -u 640 -d 5120" # 5Mb up, 40Mb down"
734
734
  #DUPL_PRECMD=""
@@ -738,11 +738,11 @@ SOURCE='${DEFAULT_SOURCE}'
738
738
  #FILENAME='.duplicity-ignore'
739
739
  #DUPL_PARAMS="\$DUPL_PARAMS --exclude-if-present '\$FILENAME'"
740
740
 
741
- # Time frame for old backups to keep, Used for the "purge" command.
741
+ # Time frame for old backups to keep, Used for the "purge" command.
742
742
  # see duplicity man page, chapter TIME_FORMATS)
743
743
  #MAX_AGE=1M
744
744
 
745
- # Number of full backups to keep. Used for the "purge-full" command.
745
+ # Number of full backups to keep. Used for the "purge-full" command.
746
746
  # See duplicity man page, action "remove-all-but-n-full".
747
747
  #MAX_FULL_BACKUPS=1
748
748
 
@@ -751,17 +751,17 @@ SOURCE='${DEFAULT_SOURCE}'
751
751
  # See duplicity man page, action "remove-all-inc-of-but-n-full".
752
752
  #MAX_FULLS_WITH_INCRS=1
753
753
 
754
- # activates duplicity --full-if-older-than option (since duplicity v0.4.4.RC3)
755
- # forces a full backup if last full backup reaches a specified age, for the
754
+ # activates duplicity --full-if-older-than option (since duplicity v0.4.4.RC3)
755
+ # forces a full backup if last full backup reaches a specified age, for the
756
756
  # format of MAX_FULLBKP_AGE see duplicity man page, chapter TIME_FORMATS
757
757
  # Uncomment the following two lines to enable this setting.
758
758
  #MAX_FULLBKP_AGE=1M
759
- #DUPL_PARAMS="\$DUPL_PARAMS --full-if-older-than \$MAX_FULLBKP_AGE "
759
+ #DUPL_PARAMS="\$DUPL_PARAMS --full-if-older-than \$MAX_FULLBKP_AGE "
760
760
 
761
761
  # sets duplicity --volsize option (available since v0.4.3.RC7)
762
762
  # set the size of backup chunks to VOLSIZE MB instead of the default 25MB.
763
763
  # VOLSIZE must be number of MB's to set the volume size to.
764
- # Uncomment the following two lines to enable this setting.
764
+ # Uncomment the following two lines to enable this setting.
765
765
  #VOLSIZE=50
766
766
  #DUPL_PARAMS="\$DUPL_PARAMS --volsize \$VOLSIZE "
767
767
 
@@ -773,36 +773,36 @@ SOURCE='${DEFAULT_SOURCE}'
773
773
  # for a successful restoration process. (default is '/tmp', if not set)
774
774
  #TEMP_DIR=/tmp
775
775
 
776
- # Modifies archive-dir option (since 0.6.0) Defines a folder that holds
777
- # unencrypted meta data of the backup, enabling new incrementals without the
778
- # need to decrypt backend metadata first. If empty or deleted somehow, the
776
+ # Modifies archive-dir option (since 0.6.0) Defines a folder that holds
777
+ # unencrypted meta data of the backup, enabling new incrementals without the
778
+ # need to decrypt backend metadata first. If empty or deleted somehow, the
779
779
  # private key and it's password are needed.
780
- # NOTE: This is confidential data. Put it somewhere safe. It can grow quite
780
+ # NOTE: This is confidential data. Put it somewhere safe. It can grow quite
781
781
  # big over time so you might want to put it not in the home dir.
782
782
  # default '~/.cache/duplicity/duply_<profile>/'
783
783
  # if set '\${ARCH_DIR}/<profile>'
784
784
  #ARCH_DIR=/some/space/safe/.duply-cache
785
785
 
786
786
  # DEPRECATED setting
787
- # sets duplicity --time-separator option (since v0.4.4.RC2) to allow users
788
- # to change the time separator from ':' to another character that will work
787
+ # sets duplicity --time-separator option (since v0.4.4.RC2) to allow users
788
+ # to change the time separator from ':' to another character that will work
789
789
  # on their system. HINT: For Windows SMB shares, use --time-separator='_'.
790
790
  # NOTE: '-' is not valid as it conflicts with date separator.
791
- # ATTENTION: only use this with duplicity < 0.5.10, since then default file
792
- # naming is compatible and this option is pending depreciation
791
+ # ATTENTION: only use this with duplicity < 0.5.10, since then default file
792
+ # naming is compatible and this option is pending depreciation
793
793
  #DUPL_PARAMS="\$DUPL_PARAMS --time-separator _ "
794
794
 
795
795
  # DEPRECATED setting
796
796
  # activates duplicity --short-filenames option, when uploading to a file
797
797
  # system that can't have filenames longer than 30 characters (e.g. Mac OS 8)
798
798
  # or have problems with ':' as part of the filename (e.g. Microsoft Windows)
799
- # ATTENTION: only use this with duplicity < 0.5.10, later versions default file
799
+ # ATTENTION: only use this with duplicity < 0.5.10, later versions default file
800
800
  # naming is compatible and this option is pending depreciation
801
801
  #DUPL_PARAMS="\$DUPL_PARAMS --short-filenames "
802
802
 
803
803
  # more duplicity command line options can be added in the following way
804
804
  # don't forget to leave a separating space char at the end
805
- #DUPL_PARAMS="\$DUPL_PARAMS --put_your_options_here "
805
+ #DUPL_PARAMS="\$DUPL_PARAMS --put_your_options_here "
806
806
 
807
807
  EOF
808
808
 
@@ -823,7 +823,7 @@ EOF
823
823
  cat <<EOF
824
824
 
825
825
  Congratulations. You just created the profile '$FTPLCFG'.
826
- The initial config file has been created as
826
+ The initial config file has been created as
827
827
  '$CONF'.
828
828
  You should now adjust this config file to your needs.
829
829
 
@@ -839,12 +839,12 @@ function hint_profile {
839
839
  cat <<EOF
840
840
  IMPORTANT:
841
841
  Copy the _whole_ profile folder after the first backup to a safe place.
842
- It contains everything needed to restore your backups. You will need
843
- it if you have to restore the backup from another system (e.g. after a
844
- system crash). Keep access to these files restricted as they contain
842
+ It contains everything needed to restore your backups. You will need
843
+ it if you have to restore the backup from another system (e.g. after a
844
+ system crash). Keep access to these files restricted as they contain
845
845
  _all_ informations (gpg data, ftp data) to access and modify your backups.
846
846
 
847
- Repeat this step after _all_ configuration changes. Some configuration
847
+ Repeat this step after _all_ configuration changes. Some configuration
848
848
  options are crucial for restoration.
849
849
 
850
850
  EOF
@@ -884,7 +884,7 @@ function error {
884
884
 
885
885
  function error_gpg {
886
886
  [ -n "$2" ] && local hint="\n $2\n\n "
887
-
887
+
888
888
  error "$1
889
889
 
890
890
  Hint${hint:+s}:
@@ -892,7 +892,7 @@ Hint${hint:+s}:
892
892
  Don't forget the used _password_ as you will need it.
893
893
  When done enter the 8 digit id & the password in the profile conf file.
894
894
 
895
- The key id can be found doing a 'gpg --list-keys'. In the example output
895
+ The key id can be found doing a 'gpg --list-keys'. In the example output
896
896
  below the key id would be FFFFFFFF for the public key.
897
897
 
898
898
  pub 1024D/FFFFFFFF 2007-12-17
@@ -905,7 +905,7 @@ function error_gpg_key {
905
905
  local KEY_ID="$1"
906
906
  local KIND="$2"
907
907
  error_gpg "${KIND} gpg key '${KEY_ID}' cannot be found." \
908
- "Doublecheck if the above key is listed by 'gpg --list-keys' or available
908
+ "Doublecheck if the above key is listed by 'gpg --list-keys' or available
909
909
  as gpg key file '$(basename "$(gpg_keyfile "${KEY_ID}")")' in the profile folder.
910
910
  If not you can put it there and $ME will autoimport it on the next run.
911
911
  Alternatively import it manually as the user you plan to run $ME with."
@@ -917,9 +917,9 @@ function error_gpg_test {
917
917
  error "$1
918
918
 
919
919
  Hint${hint:+s}:
920
- ${hint}This error means that gpg is probably misconfigured or not working
920
+ ${hint}This error means that gpg is probably misconfigured or not working
921
921
  correctly. The error message above should help to solve the problem.
922
- However, if for some reason $ME should misinterpret the situation you
922
+ However, if for some reason $ME should misinterpret the situation you
923
923
  can define GPG_TEST='disabled' in the conf file to bypass the test.
924
924
  Please do not forget to report the bug in order to resolve the problem
925
925
  in future versions of $ME.
@@ -957,7 +957,7 @@ function duplicity_version_get {
957
957
 
958
958
  function duplicity_version_check {
959
959
  if [ $DUPL_VERSION_VALUE -eq 0 ]; then
960
- inform "duplicity version check failed (please report, this is a bug)"
960
+ inform "duplicity version check failed (please report, this is a bug)"
961
961
  elif [ $DUPL_VERSION_VALUE -le 404 ] && [ ${DUPL_VERSION_RC:-4} -lt 4 ]; then
962
962
  error "The installed version $DUPL_VERSION is incompatible with $ME v$ME_VERSION.
963
963
  You should upgrade your version of duplicity to at least v0.4.4RC4 or
@@ -976,9 +976,9 @@ function duplicity_version_lt {
976
976
  function run_script { # run pre/post scripts
977
977
  local ERR=0
978
978
  local SCRIPT="$1"
979
- if [ ! -z "$PREVIEW" ] ; then
979
+ if [ ! -z "$PREVIEW" ] ; then
980
980
  echo "$([ ! -x "$SCRIPT" ] && echo ". ")$SCRIPT"
981
- elif [ -r "$SCRIPT" ] ; then
981
+ elif [ -r "$SCRIPT" ] ; then
982
982
  echo -n "Running '$SCRIPT' "
983
983
  if [ -x "$SCRIPT" ]; then
984
984
  OUT=$("$SCRIPT" 2>&1)
@@ -1077,7 +1077,7 @@ function duplicity_params_conf {
1077
1077
  echo "$DUPL_PARAMS" | awk '{gsub(/--(ex|in)clude[a-z-]*(([ \t]+|=)[^-][^ \t]+)?/,"");print}'
1078
1078
  return
1079
1079
  fi
1080
-
1080
+
1081
1081
  echo "$DUPL_PARAMS"
1082
1082
  }
1083
1083
 
@@ -1115,7 +1115,7 @@ function secureconf { # secure the configuration dir
1115
1115
  local PERMS="$(ls -la "$CONFDIR/." | awk 'NR==2{print $1}')"
1116
1116
  if [ "${PERMS/#drwx------*/OK}" != 'OK' ] ; then
1117
1117
  chmod u+rwX,go= "$CONFDIR"; local ERR=$?
1118
- warning "The profile's folder
1118
+ warning "The profile's folder
1119
1119
  '$CONFDIR'
1120
1120
  permissions are not safe ($PERMS). Secure them now. - ($(error_to_string $ERR))"
1121
1121
  fi
@@ -1129,7 +1129,7 @@ function date_fix {
1129
1129
  echo $date && return
1130
1130
  # date bsd,osx with -r epoch
1131
1131
  date=$(date ${2:+-r $2} ${1:++"$1"} 2> /dev/null) && \
1132
- echo $date && return
1132
+ echo $date && return
1133
1133
  # date busybox with -d epoch -D %s
1134
1134
  date=$(date ${2:+-d $2 -D %s} ${1:++"$1"} 2> /dev/null) && \
1135
1135
  echo $date && return
@@ -1210,19 +1210,19 @@ function isnumber {
1210
1210
  }
1211
1211
 
1212
1212
  #function tmp_space {
1213
- #
1213
+ #
1214
1214
  # if ! isnumber $VOLSIZE; then
1215
1215
  # inform "failed to determine free space (please report, this is a bug)"
1216
1216
  # return
1217
1217
  # fi
1218
- #
1218
+ #
1219
1219
  # get free temp space
1220
1220
  # TEMP_FREE="$(df -P -k "$TEMP_DIR" 2>/dev/null | awk 'END{pos=(NF-2);if(pos>0) print $pos;}')"
1221
1221
  # # check for free space or FAIL
1222
1222
  # if [ $((${TEMP_FREE:-0}-${VOLSIZE:-0}*1024)) -lt 0-lt 0 ]; then
1223
1223
  # error "Temporary file space '$TEMP_DIR' free space is smaller ($((TEMP_FREE/1024))MB)
1224
1224
  #than one duplicity volume (${VOLSIZE}MB).
1225
- #
1225
+ #
1226
1226
  # Hint: Free space or change TEMP_DIR setting."
1227
1227
  #fi
1228
1228
  #
@@ -1261,17 +1261,17 @@ function gpg_import {
1261
1261
  local KEYFILES=( "$CONFDIR/gpgkey" $(gpg_keyfile "$KEY_ID") \
1262
1262
  $(gpg_keyfile "$KEY_ID" PUB) $(gpg_keyfile "$KEY_ID" SEC))
1263
1263
 
1264
- # Try autoimport from existing old gpgkey files
1264
+ # Try autoimport from existing old gpgkey files
1265
1265
  # and new gpgkey.XXX.asc files (since v1.4.2)
1266
1266
  # and even newer gpgkey.XXX.[pub|sec].asc
1267
1267
  for (( i = 0 ; i < ${#KEYFILES[@]} ; i++ )); do
1268
1268
  FILE=${KEYFILES[$i]}
1269
1269
  if [ -f "$FILE" ]; then
1270
1270
  FOUND=1
1271
-
1271
+
1272
1272
  CMD_MSG="Import keyfile '$FILE' to keyring"
1273
1273
  run_cmd "$GPG" $GPG_OPTS --batch --import "$FILE"
1274
- if [ "$?" != "0" ]; then
1274
+ if [ "$?" != "0" ]; then
1275
1275
  warning "Import failed.${CMD_OUT:+\n$CMD_OUT}"
1276
1276
  ERR=1
1277
1277
  # continue with next
@@ -1287,13 +1287,13 @@ function gpg_import {
1287
1287
  # try to set trust automagically
1288
1288
  CMD_MSG="Autoset trust of key '$KEY_ID' to ultimate"
1289
1289
  run_cmd echo $(gpg_fingerprint "$KEY_ID"):6: \| "$GPG" $GPG_OPTS --import-ownertrust --batch --logger-fd 1
1290
- if [ "$?" = "0" ] && [ -z "$PREVIEW" ]; then
1290
+ if [ "$?" = "0" ] && [ -z "$PREVIEW" ]; then
1291
1291
  # success on all levels, we're done
1292
1292
  return $ERR
1293
1293
  fi
1294
1294
 
1295
1295
  # failover: user has to set trust manually
1296
- echo -e "For $ME to work you have to set the trust level
1296
+ echo -e "For $ME to work you have to set the trust level
1297
1297
  with the command \"trust\" to \"ultimate\" (5) now.
1298
1298
  Exit the edit mode of gpg with \"quit\"."
1299
1299
  CMD_MSG="Running gpg to manually edit key '$KEY_ID'"
@@ -1338,7 +1338,7 @@ function gpg_export_if_needed {
1338
1338
  fi
1339
1339
  done
1340
1340
  done
1341
-
1341
+
1342
1342
  [ -n "$SUCCESS" ] && inform "$ME exported new keys to your profile.
1343
1343
  You should backup your changed profile folder now and store it in a safe place."
1344
1344
  }
@@ -1430,7 +1430,7 @@ function gpg_symmetric {
1430
1430
  # checks for max two params if they are set, typically GPG_PW & GPG_PW_SIGN
1431
1431
  function gpg_param_passwd {
1432
1432
  var_isset GPG_USEAGENT && exit 1
1433
-
1433
+
1434
1434
  if ( [ -n "$1" ] && var_isset "$1" ) || ( [ -n "$2" ] && var_isset "$2" ); then
1435
1435
  echo "--passphrase-fd 0 --batch"
1436
1436
  fi
@@ -1439,7 +1439,7 @@ function gpg_param_passwd {
1439
1439
  # select the earlist defined and create an "echo <value> |" string
1440
1440
  function gpg_pass_pipein {
1441
1441
  var_isset GPG_USEAGENT && exit 1
1442
-
1442
+
1443
1443
  for var in "$@"
1444
1444
  do
1445
1445
  if var_isset "$var"; then
@@ -1447,7 +1447,7 @@ function gpg_pass_pipein {
1447
1447
  return 0
1448
1448
  fi
1449
1449
  done
1450
-
1450
+
1451
1451
  return 1
1452
1452
  }
1453
1453
 
@@ -1461,7 +1461,7 @@ function gpg_agent_avail {
1461
1461
  ps -p $(echo $GPG_AGENT_INFO|awk -F: '{print $2}') > /dev/null 2>&1 &&\
1462
1462
  ERR=0 || ERR=2
1463
1463
  fi
1464
-
1464
+
1465
1465
  return $ERR
1466
1466
  }
1467
1467
 
@@ -1497,7 +1497,7 @@ case "$cmd" in
1497
1497
  '$CONFDIR'.
1498
1498
 
1499
1499
  Hint:
1500
- If you _really_ want to create a new profile by this name you will
1500
+ If you _really_ want to create a new profile by this name you will
1501
1501
  have to manually delete the existing profile folder first."
1502
1502
  exit 1
1503
1503
  else
@@ -1524,8 +1524,8 @@ Hint:
1524
1524
  # if we reach here, user either forgot profile or chose wrong profileless command
1525
1525
  if [ ${#@} -le 1 ]; then
1526
1526
  error "\
1527
- Missing or wrong parameters.
1528
- Only the commands
1527
+ Missing or wrong parameters.
1528
+ Only the commands
1529
1529
  changelog, create, usage, txt2man, version
1530
1530
  can be called without selecting an existing profile first.
1531
1531
  Your command was '$cmd'.
@@ -1550,7 +1550,7 @@ duplicity_version_check
1550
1550
  ### read configuration
1551
1551
  set_config
1552
1552
  # check validity
1553
- if [ ! -d "$CONFDIR" ]; then
1553
+ if [ ! -d "$CONFDIR" ]; then
1554
1554
  error "Selected profile '$FTPLCFG' does not resolve to a profile folder in
1555
1555
  '$CONFDIR'.
1556
1556
 
@@ -1562,7 +1562,7 @@ elif [ ! -x "$CONFDIR" ]; then
1562
1562
  error "\
1563
1563
  Profile folder in '$CONFDIR' cannot be accessed.
1564
1564
 
1565
- Hint:
1565
+ Hint:
1566
1566
  Check the filesystem permissions and set directory accessible e.g. 'chmod 700'."
1567
1567
  elif [ ! -f "$CONF" ] ; then
1568
1568
  error "'$CONF' not found."
@@ -1614,21 +1614,21 @@ eval ${TARGET_SPLIT_URL}
1614
1614
 
1615
1615
  # check if backend specific software is in path
1616
1616
  [ -n "$(echo ${TARGET_URL_PROT} | grep -i -e '^ftp://$')" ] && \
1617
- [ -z "$(which ncftp 2>/dev/null)" ] && error_path "Protocol 'ftp' needs ncftp. Installed und available in path?"
1617
+ [ -z "$(which ncftp 2>/dev/null)" ] && error_path "Protocol 'ftp' needs ncftp. Installed und available in path?"
1618
1618
  [ -n "$(echo ${TARGET_URL_PROT} | grep -i -e '^ftps://$')" ] && \
1619
1619
  [ -z "$(which lftp 2>/dev/null)" ] && error_path "Protocol 'ftps' needs lftp. Installed und available in path?"
1620
1620
 
1621
1621
  # fetch commmand from parameters ########################################################
1622
- # Hint: cmds is also used to check if authentification info sufficient in the next step
1622
+ # Hint: cmds is also used to check if authentification info sufficient in the next step
1623
1623
  cmds="$2"; shift 2
1624
1624
 
1625
- # translate backup to batch command
1625
+ # translate backup to batch command
1626
1626
  cmds=${cmds//backup/pre_bkp_post}
1627
1627
 
1628
1628
  # complain if command(s) missing
1629
1629
  [ -z $cmds ] && error " No command given.
1630
1630
 
1631
- Hint:
1631
+ Hint:
1632
1632
  Use '$ME usage' to get usage help."
1633
1633
 
1634
1634
  # process params
@@ -1659,31 +1659,31 @@ done
1659
1659
 
1660
1660
  # plausibility check config - VARS & KEY ################################################
1661
1661
  # check if src, trg, trg pw
1662
- # auth info sufficient
1662
+ # auth info sufficient
1663
1663
  # gpg key, gpg pwd (might be empty) set in config
1664
1664
  # OR key in local gpg db
1665
- # OR key can be imported from keyfile
1665
+ # OR key can be imported from keyfile
1666
1666
  # OR fail
1667
1667
  if [ -z "$SOURCE" ] || [ "$SOURCE" == "${DEFAULT_SOURCE}" ]; then
1668
- error " Source Path (setting SOURCE) not set or still default value in conf file
1668
+ error " Source Path (setting SOURCE) not set or still default value in conf file
1669
1669
  '$CONF'."
1670
1670
 
1671
1671
  elif [ -z "$TARGET" ] || [ "$TARGET" == "${DEFAULT_TARGET}" ]; then
1672
- error " Backup Target (setting TARGET) not set or still default value in conf file
1672
+ error " Backup Target (setting TARGET) not set or still default value in conf file
1673
1673
  '$CONF'."
1674
1674
 
1675
1675
  elif var_isset 'TARGET_USER' && var_isset 'TARGET_URL_USER' && \
1676
1676
  [ "${TARGET_USER}" != "${TARGET_URL_USER}" ]; then
1677
- error " TARGET_USER ('${TARGET_USER}') _and_ user in TARGET url ('${TARGET_URL_USER}')
1677
+ error " TARGET_USER ('${TARGET_USER}') _and_ user in TARGET url ('${TARGET_URL_USER}')
1678
1678
  are configured with different values. There can be only one.
1679
-
1679
+
1680
1680
  Hint: Remove conflicting setting."
1681
1681
 
1682
1682
  elif var_isset 'TARGET_PASS' && var_isset 'TARGET_URL_PASS' && \
1683
1683
  [ "${TARGET_PASS}" != "${TARGET_URL_PASS}" ]; then
1684
- error " TARGET_PASS ('${TARGET_PASS}') _and_ password in TARGET url ('${TARGET_URL_PASS}')
1684
+ error " TARGET_PASS ('${TARGET_PASS}') _and_ password in TARGET url ('${TARGET_URL_PASS}')
1685
1685
  are configured with different values. There can be only one.
1686
-
1686
+
1687
1687
  Hint: Remove conflicting setting."
1688
1688
  fi
1689
1689
 
@@ -1699,13 +1699,13 @@ if ( ( ! var_isset 'TARGET_USER' && ! var_isset 'TARGET_URL_USER' ) && \
1699
1699
  [ -z "$(echo ${cmds} | grep -e '\(bkp\|incr\|full\|purge\|cleanup\)')" ]; then
1700
1700
  : # still fine, it's possible to read only access configured buckets anonymously
1701
1701
  else
1702
- error " Backup target credentials needed but not set in conf file
1702
+ error " Backup target credentials needed but not set in conf file
1703
1703
  '$CONF'.
1704
- Setting TARGET_USER or TARGET_PASS or the corresponding values in TARGET url
1705
- are missing. Some protocols only might need it for write access to the backup
1704
+ Setting TARGET_USER or TARGET_PASS or the corresponding values in TARGET url
1705
+ are missing. Some protocols only might need it for write access to the backup
1706
1706
  repository (commands: bkp,backup,full,incr,purge) but not for read only access
1707
- (e.g. verify,list,restore,fetch).
1708
-
1707
+ (e.g. verify,list,restore,fetch).
1708
+
1709
1709
  Hints:
1710
1710
  Add the credentials (user,password) to the conf file.
1711
1711
  To force an empty password set TARGET_PASS='' or TARGET='prot://user:@host..'.
@@ -1717,18 +1717,18 @@ fi
1717
1717
  if gpg_disabled; then
1718
1718
  : # encryption disabled, all is well
1719
1719
  elif [ -z "${GPG_KEY}${GPG_KEYS_ENC}${GPG_KEY_SIGN}" ] && ! var_isset 'GPG_PW'; then
1720
- warning "GPG_KEY, GPG_KEYS_ENC, GPG_KEY_SIGN and GPG_PW are empty/not set in conf file
1720
+ warning "GPG_KEY, GPG_KEYS_ENC, GPG_KEY_SIGN and GPG_PW are empty/not set in conf file
1721
1721
  '$CONF'.
1722
1722
  Will disable encryption for duplicity now.
1723
1723
 
1724
- Hint:
1725
- If you really want to use _no_ encryption you can disable this warning by
1724
+ Hint:
1725
+ If you really want to use _no_ encryption you can disable this warning by
1726
1726
  setting GPG_KEY='disabled' in conf file."
1727
1727
  GPG_KEY='disabled'
1728
1728
  fi
1729
1729
 
1730
1730
  # GPG availability check (now we know if gpg is really needed)#################
1731
- if ! gpg_disabled; then
1731
+ if ! gpg_disabled; then
1732
1732
  GPG="$(which gpg 2>/dev/null)"
1733
1733
  [ -z "$GPG" ] && error_path "gpg missing. installed und available in path?"
1734
1734
  fi
@@ -1743,8 +1743,8 @@ if gpg_disabled; then
1743
1743
  else
1744
1744
 
1745
1745
  # key set?
1746
- if [ "$GPG_KEY" == "${DEFAULT_GPG_KEY}" ]; then
1747
- error_gpg "Encryption Key GPG_KEY still default in conf file
1746
+ if [ "$GPG_KEY" == "${DEFAULT_GPG_KEY}" ]; then
1747
+ error_gpg "Encryption Key GPG_KEY still default in conf file
1748
1748
  '$CONF'."
1749
1749
  fi
1750
1750
 
@@ -1775,7 +1775,7 @@ elif ! var_isset 'GPG_KEY_SIGN'; then
1775
1775
  if [ -z "${KEY_ID}" ]; then
1776
1776
  echo "Signing disabled. Not GPG_KEY entries in config."
1777
1777
  GPG_KEY_SIGN='disabled'
1778
- else
1778
+ else
1779
1779
  # use avail OR try import OR fail
1780
1780
  if gpg_sec_avail "${KEY_ID}"; then
1781
1781
  GPG_KEY_SIGN="${KEY_ID}"
@@ -1805,12 +1805,12 @@ else
1805
1805
  fi
1806
1806
  fi
1807
1807
 
1808
- # pw set?
1808
+ # pw set?
1809
1809
  # symmetric needs one, always
1810
1810
  if gpg_symmetric && ( [ -z "$GPG_PW" ] || [ "$GPG_PW" == "${DEFAULT_GPG_PW}" ] ) \
1811
1811
  ; then
1812
- error_gpg "Encryption passphrase GPG_PW (needed for symmetric encryption)
1813
- is empty/not set or still default value in conf file
1812
+ error_gpg "Encryption passphrase GPG_PW (needed for symmetric encryption)
1813
+ is empty/not set or still default value in conf file
1814
1814
  '$CONF'."
1815
1815
  fi
1816
1816
  # this is a technicality, we can only pump one pass via pipe into gpg
@@ -1819,7 +1819,7 @@ if gpg_symmetric && var_isset GPG_PW && var_isset GPG_PW_SIGN &&\
1819
1819
  [ -n "$GPG_PW_SIGN" ] && [ "$GPG_PW" != "$GPG_PW_SIGN" ]; then
1820
1820
  error_gpg "GPG_PW _and_ GPG_PW_SIGN are defined but not identical in config
1821
1821
  '$CONF'.
1822
- This is unfortunately impossible. For details see duplicity manpage,
1822
+ This is unfortunately impossible. For details see duplicity manpage,
1823
1823
  section 'A Note On Symmetric Encryption And Signing'.
1824
1824
 
1825
1825
  Tip: Separate signing keys may have empty passwords e.g. GPG_PW_SIGN=''.
@@ -1843,7 +1843,7 @@ if ! gpg_symmetric && \
1843
1843
  fi
1844
1844
  fi
1845
1845
 
1846
- # end GPG config plausibility check2
1846
+ # end GPG config plausibility check2
1847
1847
  fi
1848
1848
 
1849
1849
  # config plausibility check - SPACE ###########################################
@@ -1853,7 +1853,7 @@ CMD_MSG="Checking TEMP_DIR '${TEMP_DIR}' is a folder"
1853
1853
  run_cmd test -d "$TEMP_DIR"
1854
1854
  if [ "$?" != "0" ]; then
1855
1855
  error "Temporary file space '$TEMP_DIR' is not a directory."
1856
- fi
1856
+ fi
1857
1857
  # is tmp writeable
1858
1858
  CMD_MSG="Checking TEMP_DIR '${TEMP_DIR}' is writable"
1859
1859
  run_cmd test -w "$TEMP_DIR"
@@ -1868,7 +1868,7 @@ VOLSIZE=${VOLSIZE:-25}
1868
1868
  echo $@ $DUPL_PARAMS | grep -q -e '--asynchronous-upload' && FACTOR=2 || FACTOR=1
1869
1869
 
1870
1870
  # TODO: check for enough (async= upload space and WARN only
1871
- # use function tmp_space
1871
+ # use function tmp_space
1872
1872
  echo TODO: reimplent tmp space check
1873
1873
 
1874
1874
 
@@ -1876,12 +1876,12 @@ echo TODO: reimplent tmp space check
1876
1876
  # if encryption is disabled, skip this whole section
1877
1877
  if gpg_disabled; then
1878
1878
  echo -e "Test - En/Decryption skipped. (GPG disabled)"
1879
- elif [ "$GPG_TEST" = "disabled" ]; then
1879
+ elif [ "$GPG_TEST" = "disabled" ]; then
1880
1880
  echo -e "Test - En/Decryption skipped. (Testing disabled)"
1881
1881
  else
1882
1882
 
1883
1883
  GPG_TEST="$TEMP_DIR/${ME_NAME}.$$.$(date_fix %s)"
1884
- function cleanup_gpgtest {
1884
+ function cleanup_gpgtest {
1885
1885
  echo -en "Cleanup - Delete '${GPG_TEST}_*'"
1886
1886
  rm ${GPG_TEST}_* 2>/dev/null && echo "(OK)" || echo "(FAILED)"
1887
1887
  }
@@ -1903,7 +1903,7 @@ if [ ${#GPG_KEYS_ENC_ARRAY[@]} -gt 0 ]; then
1903
1903
  run_cmd $(gpg_pass_pipein GPG_PW_SIGN GPG_PW) $GPG $CMD_PARAM_SIGN $(gpg_param_passwd GPG_PW_SIGN GPG_PW) $CMD_PARAMS $GPG_USEAGENT --status-fd 1 $GPG_OPTS -o "${GPG_TEST}_ENC" -e "$ME_LONG"
1904
1904
  CMD_ERR=$?
1905
1905
 
1906
- if [ "$CMD_ERR" != "0" ]; then
1906
+ if [ "$CMD_ERR" != "0" ]; then
1907
1907
  KEY_NOTRUST=$(echo "$CMD_OUT"|awk '/^\[GNUPG:\] INV_RECP 10/ { print $4 }')
1908
1908
  [ -n "$KEY_NOTRUST" ] && HINT="Key '${KEY_NOTRUST}' seems to be untrusted. If you really trust this key try to
1909
1909
  'gpg --edit-key "$KEY_NOTRUST"' and raise the trust level to ultimate. If you
@@ -1917,7 +1917,7 @@ if [ ${#GPG_KEYS_ENC_ARRAY[@]} -gt 0 ]; then
1917
1917
  run_cmd $(gpg_pass_pipein GPG_PW) "$GPG" $(gpg_param_passwd GPG_PW) $GPG_OPTS -o "${GPG_TEST}_DEC" $GPG_USEAGENT -d "${GPG_TEST}_ENC"
1918
1918
  CMD_ERR=$?
1919
1919
 
1920
- if [ "$CMD_ERR" != "0" ]; then
1920
+ if [ "$CMD_ERR" != "0" ]; then
1921
1921
  error_gpg_test "Decryption failed.${CMD_OUT:+\n$CMD_OUT}"
1922
1922
  fi
1923
1923
 
@@ -1927,7 +1927,7 @@ else
1927
1927
  CMD_MSG="Test - Encryption with passphrase${CMD_MSG_SIGN:+ & $CMD_MSG_SIGN}"
1928
1928
  run_cmd $(gpg_pass_pipein GPG_PW) "$GPG" $GPG_OPTS $CMD_PARAM_SIGN --passphrase-fd 0 -o "${GPG_TEST}_ENC" --batch -c "$ME_LONG"
1929
1929
  CMD_ERR=$?
1930
- if [ "$CMD_ERR" != "0" ]; then
1930
+ if [ "$CMD_ERR" != "0" ]; then
1931
1931
  error_gpg_test "Encryption failed.${CMD_OUT:+\n$CMD_OUT}"
1932
1932
  fi
1933
1933
 
@@ -1935,7 +1935,7 @@ else
1935
1935
  CMD_MSG="Test - Decryption with passphrase"
1936
1936
  run_cmd $(gpg_pass_pipein GPG_PW) "$GPG" $GPG_OPTS --passphrase-fd 0 -o "${GPG_TEST}_DEC" --batch -d "${GPG_TEST}_ENC"
1937
1937
  CMD_ERR=$?
1938
- if [ "$CMD_ERR" != "0" ]; then
1938
+ if [ "$CMD_ERR" != "0" ]; then
1939
1939
  error_gpg_test "Decryption failed.${CMD_OUT:+\n$CMD_OUT}"
1940
1940
  fi
1941
1941
  fi
@@ -1945,7 +1945,7 @@ CMD_MSG="Test - Compare"
1945
1945
  [ -r "${GPG_TEST}_DEC" ] || CMD_DISABLED="File not found. Nothing to compare."
1946
1946
  run_cmd "test \"\$(cat '$ME_LONG')\" = \"\$(cat '${GPG_TEST}_DEC')\""
1947
1947
  CMD_ERR=$?
1948
- if [ "$CMD_ERR" = "0" ]; then
1948
+ if [ "$CMD_ERR" = "0" ]; then
1949
1949
  cleanup_gpgtest
1950
1950
  else
1951
1951
  error_gpg_test "Comparision failed.${CMD_OUT:+\n$CMD_OUT}"
@@ -1969,7 +1969,7 @@ gpg_export_if_needed "${GPG_KEYS_ENC_ARRAY[@]}" "$(gpg_signing && echo $GPG_KEY_
1969
1969
  var_isset 'TARGET_URL_USER' && TARGET_URL_USER="$(url_decode "$TARGET_URL_USER")"
1970
1970
  var_isset 'TARGET_URL_PASS' && TARGET_URL_PASS="$(url_decode "$TARGET_URL_PASS")"
1971
1971
 
1972
- # defined TARGET_USER&PASS vars replace their URL pendants
1972
+ # defined TARGET_USER&PASS vars replace their URL pendants
1973
1973
  # (double defs already dealt with)
1974
1974
  var_isset 'TARGET_USER' && TARGET_URL_USER="$TARGET_USER"
1975
1975
  var_isset 'TARGET_PASS' && TARGET_URL_PASS="$TARGET_PASS"
@@ -2017,6 +2017,8 @@ case "$(tolower "${TARGET_URL_PROT%%:*}")" in
2017
2017
  ( var_isset 'TARGET_URL_USER' && ! var_isset 'SWIFT_AUTHURL' ) &&\
2018
2018
  warning "\
2019
2019
  Swift will probably fail because the conf var SWIFT_AUTHURL was not defined!"
2020
+ var_isset 'SWIFT_TENANTNAME' && \
2021
+ BACKEND_PARAMS="$BACKEND_PARAMS SWIFT_TENANTNAME=$(qw "${SWIFT_TENANTNAME}")"
2020
2022
  var_isset 'SWIFT_AUTHVERSION' && \
2021
2023
  BACKEND_PARAMS="$BACKEND_PARAMS SWIFT_AUTHVERSION=$(qw "${SWIFT_AUTHVERSION}")"
2022
2024
  var_isset 'TARGET_URL_PASS' && \
@@ -2029,8 +2031,8 @@ Swift will probably fail because the conf var SWIFT_AUTHURL was not defined!"
2029
2031
  var_isset 'TARGET_URL_USER' && BACKEND_CREDS="$(url_encode "${TARGET_URL_USER}")"
2030
2032
  if duplicity_version_lt 610; then
2031
2033
  warning "\
2032
- Duplicity version '$DUPL_VERSION' does not support providing the password as
2033
- env var for rsync backend. For security reasons you should consider to
2034
+ Duplicity version '$DUPL_VERSION' does not support providing the password as
2035
+ env var for rsync backend. For security reasons you should consider to
2034
2036
  update to a version greater than '0.6.10' of duplicity."
2035
2037
  var_isset 'TARGET_URL_PASS' && BACKEND_CREDS="${BACKEND_CREDS}:$(url_encode "${TARGET_URL_PASS}")"
2036
2038
  else
@@ -2040,9 +2042,9 @@ update to a version greater than '0.6.10' of duplicity."
2040
2042
  BACKEND_URL="${TARGET_URL_PROT}${BACKEND_CREDS}${TARGET_URL_HOSTPATH}"
2041
2043
  ;;
2042
2044
  *)
2043
- # for all other protocols we put username in url and pass into env var
2045
+ # for all other protocols we put username in url and pass into env var
2044
2046
  # for sec˙rity reasons, we url_encode username to protect special chars
2045
- var_isset 'TARGET_URL_USER' &&
2047
+ var_isset 'TARGET_URL_USER' &&
2046
2048
  BACKEND_CREDS="$(url_encode "${TARGET_URL_USER}")@"
2047
2049
  # sortout backends with special ways to handle password
2048
2050
  case "$(tolower "${TARGET_URL_PROT%%:*}")" in
@@ -2065,7 +2067,7 @@ update to a version greater than '0.6.10' of duplicity."
2065
2067
  ;;
2066
2068
  esac
2067
2069
 
2068
- # protect eval from special chars in url (e.g. open ')' in password,
2070
+ # protect eval from special chars in url (e.g. open ')' in password,
2069
2071
  # spaces in path, quotes) happens above in duplify() via quotewrap()
2070
2072
  SOURCE="$SOURCE"
2071
2073
  BACKEND_URL="$BACKEND_URL"
@@ -2154,10 +2156,10 @@ case "$(tolower $cmd)" in
2154
2156
  ;;
2155
2157
  'verifypath')
2156
2158
  TIME="${ftpl_pars[2]:+"-t ${ftpl_pars[2]}"}"
2157
- IN_PATH="${ftpl_pars[0]}"; OUT_PATH="${ftpl_pars[1]}";
2159
+ IN_PATH="${ftpl_pars[0]}"; OUT_PATH="${ftpl_pars[1]}";
2158
2160
  ( [ -z "$IN_PATH" ] || [ -z "$OUT_PATH" ] ) && error " Missing parameter <rel_bkp_path> or <local_path> for verifyPath.
2159
-
2160
- Hint:
2161
+
2162
+ Hint:
2161
2163
  Syntax is -> $ME <profile> verifyPath <rel_bkp_path> <local_path> [<age>]"
2162
2164
 
2163
2165
  duplify verify -- $TIME "${dupl_opts[@]}" --exclude-globbing-filelist "$EXCLUDE" \
@@ -2174,49 +2176,48 @@ case "$(tolower $cmd)" in
2174
2176
  'purge')
2175
2177
  MAX_AGE=${ftpl_pars[0]:-$MAX_AGE}
2176
2178
  [ -z "$MAX_AGE" ] && error " Missing parameter <max_age>. Can be set in profile or as command line parameter."
2177
-
2179
+
2178
2180
  duplify remove-older-than "${MAX_AGE}" \
2179
2181
  -- "${dupl_opts[@]}" "$BACKEND_URL"
2180
2182
  ;;
2181
2183
  'purgefull')
2182
2184
  MAX_FULL_BACKUPS=${ftpl_pars[0]:-$MAX_FULL_BACKUPS}
2183
2185
  [ -z "$MAX_FULL_BACKUPS" ] && error " Missing parameter <max_full_backups>. Can be set in profile or as command line parameter."
2184
-
2186
+
2185
2187
  duplify remove-all-but-n-full "${MAX_FULL_BACKUPS}" \
2186
2188
  -- "${dupl_opts[@]}" "$BACKEND_URL"
2187
2189
  ;;
2188
2190
  'purgeincr')
2189
2191
  MAX_FULLS_WITH_INCRS=${ftpl_pars[0]:-$MAX_FULLS_WITH_INCRS}
2190
2192
  [ -z "$MAX_FULLS_WITH_INCRS" ] && error " Missing parameter <max_fulls_with_incrs>. Can be set in profile or as command line parameter."
2191
-
2193
+
2192
2194
  duplify remove-all-inc-of-but-n-full "${MAX_FULLS_WITH_INCRS}" \
2193
2195
  -- "${dupl_opts[@]}" "$BACKEND_URL"
2194
2196
  ;;
2195
2197
  'restore')
2196
2198
  OUT_PATH="${ftpl_pars[0]:-$SOURCE}"; TIME="${ftpl_pars[1]:-now}";
2197
2199
  [ -z "$OUT_PATH" ] && error " Missing parameter target_path for restore.
2198
-
2199
- Hint:
2200
+
2201
+ Hint:
2200
2202
  Syntax is -> $ME <profile> restore <target_path> [<age>]"
2201
-
2202
- duplify -- -t "$TIME" "${dupl_opts[@]}" "$BACKEND_URL" "$OUT_PATH"
2203
- run_script $CONFDIR/restore;
2203
+
2204
+ duplify -- -t "$TIME" "${dupl_opts[@]}" "$BACKEND_URL" "$OUT_PATH" && run_script $CONFDIR/restore;
2204
2205
  ;;
2205
2206
  'fetch')
2206
- IN_PATH="${ftpl_pars[0]}"; OUT_PATH="${ftpl_pars[1]}";
2207
+ IN_PATH="${ftpl_pars[0]}"; OUT_PATH="${ftpl_pars[1]}";
2207
2208
  TIME="${ftpl_pars[2]:-now}";
2208
2209
  ( [ -z "$IN_PATH" ] || [ -z "$OUT_PATH" ] ) && error " Missing parameter <src_path> or <target_path> for fetch.
2209
-
2210
- Hint:
2210
+
2211
+ Hint:
2211
2212
  Syntax is -> $ME <profile> fetch <src_path> <target_path> [<age>]"
2212
-
2213
+
2213
2214
  # duplicity 0.4.7 doesnt like cmd restore in combination with --file-to-restore
2214
2215
  duplify -- --restore-time "$TIME" "${dupl_opts[@]}" \
2215
2216
  --file-to-restore "$IN_PATH" "$BACKEND_URL" "$OUT_PATH"
2216
2217
  ;;
2217
2218
  'status')
2218
2219
  duplify collection-status -- "${dupl_opts[@]}" "$BACKEND_URL"
2219
- ;;
2220
+ ;;
2220
2221
  *)
2221
2222
  warning "Unknown command '$cmd'."
2222
2223
  ;;