From f83346b9b3fbc4d443589c96d573f48828da451d Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 2 Nov 2017 21:34:04 -0700 Subject: [PATCH] Support for using tilde in repository paths to reference home directory. --- NEWS | 5 +++-- borgmatic/commands/borgmatic.py | 3 ++- borgmatic/config/schema.yaml | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 49afdde..d64e283 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ 1.1.10.dev0 - * Passing several Unix signals through to child processes like Borg. This means that Borg now - properly shuts down if borgmatic is terminated (e.g. due to a system suspend). + * Pass several Unix signals through to child processes like Borg. This means that Borg now properly + shuts down if borgmatic is terminated (e.g. due to a system suspend). + * #29: Support for using tilde in repository paths to reference home directory. 1.1.9 * #16, #38: Support for user-defined hooks before/after backup, or on error. diff --git a/borgmatic/commands/borgmatic.py b/borgmatic/commands/borgmatic.py index 1d66c26..ad3e297 100644 --- a/borgmatic/commands/borgmatic.py +++ b/borgmatic/commands/borgmatic.py @@ -97,7 +97,8 @@ def run_configuration(config_filename, args): # pragma: no cover create.initialize(storage) hook.execute_hook(hooks.get('before_backup'), config_filename, 'pre-backup') - for repository in location['repositories']: + for unexpanded_repository in location['repositories']: + repository = os.path.expanduser(unexpanded_repository) if args.prune: logger.info('{}: Pruning archives'.format(repository)) prune.prune_archives(args.verbosity, repository, retention, remote_path=remote_path) diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index c70cba0..8cfa32f 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -31,8 +31,8 @@ map: seq: - type: scalar desc: | - Paths to local or remote repositories (required). Multiple repositories are - backed up to in sequence. + Paths to local or remote repositories (required). Tildes are expanded. Multiple + repositories are backed up to in sequence. example: - user@backupserver:sourcehostname.borg exclude_patterns: