containers / containers/toolbox

Allow (potentially selective) preservation of environment variables

Open
#998 0 comments 0 reactions 0 assignees View on GitHub
1. Feature request
Dominant language
Go
Stars
3.5k
Forks
262
Avg merge
3d 1h
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**
I mostly manage my environment variables with systemd's environment.d, esp. because certain ones are necessary for the graphical environment to function. I don't repeat these in my shell start-up files, but certain parts of those assume they are set, which they are in pretty much every scenario that isn't me logging in on a TTY. Unfortunately, toolbox does not preserve these variables, making my regular shell environment inoperable.

**Describe the solution you'd like**
`toolbox enter` should ideally preserve the calling environment as closely as possible.

**Describe alternatives you've considered**
- Setting defaults via `${:-}` everywhere I use the variables in question. Counterproductive because avoiding that boilerplate was a big reason for why I put certain variables into environment.d—to just ensure they're available everywhere, even if set to the default value.
- Moving all my environment setup into `.profile`. Would probably mostly work, but require boilerplate to ensure nothing weird happens in my host environment if it's sourced multiple times—once upon login and then again when I open a terminal and start a shell.

**Additional context**
I'm not sure if it makes a difference, but my host is Arch Linux, while the container I tested with was Fedora 36.

In any case, even though I (currently) don't use an immutable system like Silverblue—through which I discovered toolbox—it is still a very intriguing tool. As someone who does many radically different things on the same machine, it seems like it could be very helpful to reduce clutter and get some order into things. I could very well see it becoming a daily driver for me, so thank you for your hard work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.