diff --git a/NEWS b/NEWS index 1638e08..23f4737 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ https://torsion.org/borgmatic/docs/how-to/run-arbitrary-borg-commands/ * #719: Fix an error when running "borg key export" through borgmatic. * #720: Fix an error when dumping a MySQL database and the "exclude_nodump" option is set. + * #724: Add "check_i_know_what_i_am_doing" option to bypass Borg confirmation prompt when running + "check --repair". * When merging two configuration files, error gracefully if the two files do not adhere to the same format. * #721: Remove configuration sections ("location:", "storage:", "hooks:" etc.), while still keeping diff --git a/borgmatic/borg/environment.py b/borgmatic/borg/environment.py index 6ee3cbe..136cf95 100644 --- a/borgmatic/borg/environment.py +++ b/borgmatic/borg/environment.py @@ -11,11 +11,15 @@ OPTION_TO_ENVIRONMENT_VARIABLE = { 'temporary_directory': 'TMPDIR', } -DEFAULT_BOOL_OPTION_TO_ENVIRONMENT_VARIABLE = { +DEFAULT_BOOL_OPTION_TO_DOWNCASE_ENVIRONMENT_VARIABLE = { 'relocated_repo_access_is_ok': 'BORG_RELOCATED_REPO_ACCESS_IS_OK', 'unknown_unencrypted_repo_access_is_ok': 'BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK', } +DEFAULT_BOOL_OPTION_TO_UPPERCASE_ENVIRONMENT_VARIABLE = { + 'check_i_know_what_i_am_doing': 'BORG_CHECK_I_KNOW_WHAT_I_AM_DOING', +} + def make_environment(config): ''' @@ -33,8 +37,15 @@ def make_environment(config): for ( option_name, environment_variable_name, - ) in DEFAULT_BOOL_OPTION_TO_ENVIRONMENT_VARIABLE.items(): + ) in DEFAULT_BOOL_OPTION_TO_DOWNCASE_ENVIRONMENT_VARIABLE.items(): value = config.get(option_name, False) environment[environment_variable_name] = 'yes' if value else 'no' + for ( + option_name, + environment_variable_name, + ) in DEFAULT_BOOL_OPTION_TO_UPPERCASE_ENVIRONMENT_VARIABLE.items(): + value = storage_config.get(option_name, False) + environment[environment_variable_name] = 'YES' if value else 'NO' + return environment diff --git a/borgmatic/config/schema.yaml b/borgmatic/config/schema.yaml index b0cbe6a..59e8856 100644 --- a/borgmatic/config/schema.yaml +++ b/borgmatic/config/schema.yaml @@ -373,6 +373,12 @@ properties: Bypass Borg error about a previously unknown unencrypted repository. Defaults to false. example: true + check_i_know_what_i_am_doing: + type: boolean + description: | + Bypass Borg confirmation about check with repair option. + Defaults to false. + example: true extra_borg_options: type: object additionalProperties: false diff --git a/docs/_data/borgmatic.js b/docs/_data/borgmatic.js new file mode 100644 index 0000000..5d76ca0 --- /dev/null +++ b/docs/_data/borgmatic.js @@ -0,0 +1,5 @@ +module.exports = function() { + return { + environment: process.env.NODE_ENV || "development" + }; +}; diff --git a/docs/_includes/layouts/main.njk b/docs/_includes/layouts/main.njk index a7e5b66..81300ba 100644 --- a/docs/_includes/layouts/main.njk +++ b/docs/_includes/layouts/main.njk @@ -11,7 +11,7 @@ headerClass: elv-header-default {% set navPages = collections.all | eleventyNavigation %} {% macro renderNavListItem(entry) -%}