Skip to content

Add SudoPassCmd configuration for more convenience#112

Open
MaxG87 wants to merge 18 commits into
mainfrom
copilot/add-configuration-better-backup
Open

Add SudoPassCmd configuration for more convenience#112
MaxG87 wants to merge 18 commits into
mainfrom
copilot/add-configuration-better-backup

Conversation

@MaxG87
Copy link
Copy Markdown
Owner

@MaxG87 MaxG87 commented May 15, 2026

No description provided.

Copilot AI and others added 18 commits May 12, 2026 22:42
Rename the existing `Configuration` union type alias to `DeviceConfiguration`
and introduce a new `Configuration` BaseModel that wraps the list of device
configurations under a `deviceConfigurations` field.

For TOML, the parent section is now `butter-backup` with the array of device
entries under `device-configurations`:

    [[butter-backup.device-configurations]]
    Name = "..."

For JSON/JSON5/YAML the wrapper key is `deviceConfigurations`:

    { "deviceConfigurations": [...] }

Update all callers, tests, and example config files accordingly.

Agent-Logs-Url: https://github.com/MaxG87/ButterBackup/sessions/8df34a6f-2b3a-4151-8bd2-1d7d91224187

Co-authored-by: MaxG87 <5477952+MaxG87@users.noreply.github.com>
Add an optional `SudoPassCmd: str | None = None` field to the `Configuration`
model. When set, it holds a shell command whose stdout is a sudo password that
can be used to refresh the sudo credential cache.

Agent-Logs-Url: https://github.com/MaxG87/ButterBackup/sessions/8df34a6f-2b3a-4151-8bd2-1d7d91224187

Co-authored-by: MaxG87 <5477952+MaxG87@users.noreply.github.com>
When `SudoPassCmd` is set in the configuration, run
`SudoPassCmd | sudo -Sv` to refresh the sudo credential cache:
- before device decryption in the `open` command
- before device decryption in the `backup` command
- before unmounting in the `close` command

This prevents interactive password prompts during long backup sessions.

Agent-Logs-Url: https://github.com/MaxG87/ButterBackup/sessions/8df34a6f-2b3a-4151-8bd2-1d7d91224187

Co-authored-by: MaxG87 <5477952+MaxG87@users.noreply.github.com>
…valid path after context exit

Agent-Logs-Url: https://github.com/MaxG87/ButterBackup/sessions/c3eca6b4-12ee-4225-864d-0f6c4d8eda57

Co-authored-by: MaxG87 <5477952+MaxG87@users.noreply.github.com>
While here, two explicit composite strategies were rewritten to be just
strategies.
The file got way too long. All tests regarding sudo_pass_cmd are
extracted into their own file for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants