[opensuse-packaging] Setting environmental variables
Hi, I have a package (maven) which relies on the presence of a environment variable (MAVEN_HOME) . I have created /etc/profile.d/maven.{csh,sh} but these only work after the user logs out. How can I make the environment variable available immediately after the package is installed? Thanks, Robert -- Sent from my (old) computer -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Hi Robert, Am 20.01.12 15:05, schrieb Robert Munteanu:
I have a package (maven) which relies on the presence of a environment variable (MAVEN_HOME) . I have created /etc/profile.d/maven.{csh,sh} but these only work after the user logs out.
How can I make the environment variable available immediately after the package is installed?
That is not possible because the environment is inherited. You cannot modify the environment of an arbitrary process, just the own environment which is inherited by all processed started by itself. Of course one can manually source /etc/profile.d/*.sh in a shell to avoid having to re-login, but that cannot be automated. Regards, Bernhard -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Fri, 20 Jan 2012 15:05, Robert Munteanu <robert.munteanu@...> wrote:
Hi,
I have a package (maven) which relies on the presence of a environment variable (MAVEN_HOME) . I have created /etc/profile.d/maven.{csh,sh} but these only work after the user logs out.
How can I make the environment variable available immediately after the package is installed?
The most simple solution would be a wrapper to call your program. This wrapper would check for non-zero variable and source /etc/profile.d/maven.{csh,sh} if zero variable. Best change to get your program work out-of-the-box. If the user sets his private variable, it's respected, else it defaults to a known source. Modifing the environments of already started programs is difficult at best, ugly in most cases, and not reliable for sure. Hope this gives you a way to go on successfully. - Yamaban. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (3)
-
Bernhard Walle
-
Robert Munteanu
-
Yamaban