Suggestion: Add TMPDIR as a configuration option to the YAML configuration file #341

Closed
opened 2020-07-22 12:59:05 +00:00 by ariera · 4 comments
Contributor

What I'm trying to do and why

I am using borgmatic to backup a linux server that mounts /tmp with noexec privileges. This means I need to specify a different tempdir by using the TMPDIR env variable on every borg/borgmatic command, e.g.:

TMPDIR=/root/tmp borgmatic

Whenever I forget to specify the TMPDIR variable borg fails with a very cryptic error, that usually keeps me blocked for a couple of minutes until I remember what was missing.

Do you think it would be possible to add a configuration option to /etc/borgmatic/config.yml that specifies a non-default tempdir? Are there any drawbacks to this idea? Is this a feature you would be interested in including? If so, maybe I could try to do it myself (with some guidance :).

Alternatively, is there a way to achieve the desired effect without adding this extra functionality?

IMHO, part of the appeal of borgmatic, is not needing to have to remember and type all the configuration flags and enviroment variables that borg requires, but instead having a central config file that you can have as a reference. I believe this addition would be very welcome for scenarios like mine.

#### What I'm trying to do and why I am using borgmatic to backup a linux server that mounts `/tmp` with `noexec` privileges. This means I need to specify a different tempdir by using the `TMPDIR` env variable on every borg/borgmatic command, e.g.: ```bash TMPDIR=/root/tmp borgmatic ``` Whenever I forget to specify the `TMPDIR` variable borg fails with a very cryptic error, that usually keeps me blocked for a couple of minutes until I remember what was missing. Do you think it would be possible to add a configuration option to `/etc/borgmatic/config.yml` that specifies a non-default tempdir? Are there any drawbacks to this idea? Is this a feature you would be interested in including? If so, maybe I could try to do it myself (with some guidance :). Alternatively, is there a way to achieve the desired effect without adding this extra functionality? IMHO, part of the appeal of borgmatic, is not needing to have to remember and type all the configuration flags and enviroment variables that borg requires, but instead having a central config file that you can have as a reference. I believe this addition would be very welcome for scenarios like mine.
Owner

This totally makes sense to me! I don't know of another way to achieve this, except perhaps with a shell alias for borgmatic.. which would be kind of obnoxious.

Anyway, if you'd like to take a stab at this, please let me know! A good place to start would be having a look at borgmatic/config/schema.yaml. There are a number of existing Borg environment variables that are defined there are configuration options (e.g. borg_base_directory). I could see calling this new option just temporary_directory or something, as it's not necessarily Borg-specific.

In terms of where those options get turned into environment variables, that's in borgmatic/borg/environment.py. This should hopefully be pretty straight-forward to add and get working.

Let me know if you have any questions! And thank you for the feature suggestion.

This totally makes sense to me! I don't know of another way to achieve this, except perhaps with a shell alias for `borgmatic`.. which would be kind of obnoxious. Anyway, if you'd like to take a stab at this, please let me know! A good place to start would be having a look at `borgmatic/config/schema.yaml`. There are a number of existing Borg environment variables that are defined there are configuration options (e.g. `borg_base_directory`). I could see calling this new option just `temporary_directory` or something, as it's not *necessarily* Borg-specific. In terms of where those options get turned into environment variables, that's in `borgmatic/borg/environment.py`. This should hopefully be pretty straight-forward to add and get working. Let me know if you have any questions! And thank you for the feature suggestion.
Owner

Thanks for the PR! Merged in master and marking this done. It'll be part of the next release.

Thanks for the PR! Merged in master and marking this done. It'll be part of the next release.
Author
Contributor

Excellent, looking forward!
Thanks for your guidance... and the excellent software :)

Excellent, looking forward! Thanks for your guidance... and the excellent software :)
Owner

Just released in borgmatic 1.5.11!

Just released in borgmatic 1.5.11!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#341
No description provided.