XDG directories #562

Open
opened 2022-07-09 19:36:22 +00:00 by pikeas · 5 comments

It would be nice if Borgmatic supported the XDG spec (~/.config, ~/.local, etc). There's a Python package that can be used to enable this: https://github.com/ActiveState/appdirs

It would be nice if Borgmatic supported the XDG spec (`~/.config`, `~/.local`, etc). There's a Python package that can be used to enable this: https://github.com/ActiveState/appdirs
Owner

Thanks for filing this! By default, borgmatic already looks in ~/.config/borgmatic/config.yaml and ~/.config/borgmatic.d/ for configuration files. And the ~/.config prefix is customizable via the standard XDG_CONFIG_HOME environment variable. Is the idea that you'd like other paths to be used by default on non-Linux OSes, e.g. MacOS?

And for ~/.local, is the the thinking that's where the existing ~/.borgmatic user data would be stored instead?

Thanks for filing this! By default, borgmatic already looks in `~/.config/borgmatic/config.yaml` and `~/.config/borgmatic.d/` for configuration files. And the `~/.config` prefix is customizable via the standard `XDG_CONFIG_HOME` environment variable. Is the idea that you'd like other paths to be used by default on non-Linux OSes, e.g. MacOS? And for `~/.local`, is the the thinking that's where the existing `~/.borgmatic` user data would be stored instead?
Author

And for ~/.local, is the the thinking that's where the existing ~/.borgmatic user data would be stored instead?

Yes, sorry for the late reply. XDG_DATA_HOME (defaulting to ~/.local/share) is the XDG-compliant directory for user-specific app data. It would be nice-to-have if borgmatic fully implemented XDG.

> And for `~/.local`, is the the thinking that's where the existing `~/.borgmatic` user data would be stored instead? Yes, sorry for the late reply. `XDG_DATA_HOME` (defaulting to `~/.local/share`) is the XDG-compliant directory for user-specific app data. It would be nice-to-have if borgmatic fully implemented XDG.
Author

There's also XDG_DATA_STATE_HOME, depending on whether Borgmatic's checks/ is considered "user data" or "user state".

There's also `XDG_DATA_STATE_HOME`, depending on whether Borgmatic's `checks/` is considered "user data" or "user state".
Owner

I apologize for the delay here. I think this would be a good change in terms of standardization. The main difficulty is that the ~/.borgmatic path currently gets encoded into database backup archives in the form of dump file paths. So if changing those paths (either implicitly by default or explicitly with an option), the database restore logic might need to be updated to probe both paths within a backup archive.

Note that there is an existing borgmatic_source_directory that configures this ~/.borgmatic directory, and changing that will just unceremoneously break restores of any existing backups. However this is a comment warning of this above the option.

I apologize for the delay here. I think this would be a good change in terms of standardization. The main difficulty is that the `~/.borgmatic` path currently gets encoded into database backup archives in the form of dump file paths. So if changing those paths (either implicitly by default or explicitly with an option), the database restore logic might need to be updated to probe both paths within a backup archive. Note that there is an existing `borgmatic_source_directory` that configures this `~/.borgmatic` directory, and changing that will just unceremoneously break restores of any existing backups. However this is a comment warning of this above the option.
Owner

Relevant reference: https://wiki.archlinux.org/title/XDG_Base_Directory

Also see #838 for a related ticket.

EDIT: #638 is also related.

Relevant reference: https://wiki.archlinux.org/title/XDG_Base_Directory Also see #838 for a related ticket. EDIT: #638 is also related.
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#562
No description provided.