-
I'm always trying to bootstrap my password manager (bitwarden) before applying dotfiles. But, it always failed because in my script Reading those commits make me want to open this question. How can I bootstrap environment variables in before_ script, so the next steps, like applying and after_ script can pick that environment variables?
Currently I'm extracting that script like this: Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Sadly, this is not generally possible due to the way Linux/UNIX processes work. Environment variables are passed from parent processes to their children. They are not shared and do not pass from children to their parents. When a child process sets an environment variable (e.g. adding an extra directory to The Bitwarden password manager stores persistent logins in an environment variable, so, by design, a child Bitwarden process cannot login on behalf of a parent process. Some other password managers instead use persistent daemons which are able to communicate with both parent and child processes and so do not have this limitation. So, your only effective option is to execute the Bitwarden login in a parent process of chezmoi, which sadly cannot be achieved with a [1] In some cases, it is possible for a parent process to read a child processes's environment variables by reading the contents of |
Beta Was this translation helpful? Give feedback.
-
Just to clarify, I don't use Bitwarden and so will not raise this with the Bitwarden developers. The discussion should be started by a Bitwarden user. |
Beta Was this translation helpful? Give feedback.
Sadly, this is not generally possible due to the way Linux/UNIX processes work.
Environment variables are passed from parent processes to their children. They are not shared and do not pass from children to their parents. When a child process sets an environment variable (e.g. adding an extra directory to
$PATH
or setting a variable like$BW_SESSION
) this is only visible to the child process and not the parent [1]. So, the chezmoi process that spawns yourrun_
script does not see any changes that the child process makes.The Bitwarden password manager stores persistent logins in an environment variable, so, by design, a child Bitwarden process cannot login on behalf of a parent process. S…