[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Setting Env Variables | RPM



On Tuesday 30 January 2007 6:55 am, Lis Maria wrote:
> Hi
>
> I am facing an issue in setting environment variables through RPM.
>
> In my spec file, at the %post section,i have
>
> export JAVA_HOME=/usr/java/j2sdk1.4.2_12
>
> If i try printing,this here itself i will be shown as set.But if i try to
> print the value of JAVA_HOME,after installing the RPM,it is empty.

In Unix, including Linux, environment variables are associated to a process
and its children. If you set an environment variable, by design this setting 
is lost as soon as the process exits: so the setting of JAVA_HOME is lost 
when the rpm installation exits.

Interactive logins have a number of environment variables set because a shell 
is launched after successful login and this shell reads a number of startup 
files which explicitly set a number of environment variables. Note that, for 
example, nothing of that happens when a command is scheduled for periodic 
execution using cron or for non-interactive (no shell) accounts.

> I dont know if this is the right way for setting environment variables
> through RPM,please advice

If I'm guessing correctly and you're packaging a Java application or somesuch, 
you'll probably save yourself much pain and grief by starting from here

  http://www.jpackage.org

which is an effort for packaging Java-related software using RPM. A number of 
distributions are using JPackage as the base for their own packaging of Java 
software on Linux, and my personal experience has been very positive.

Please note that you'll have to leave behind a number of misconceptions 
gathered on Windows platforms, such as the nature of environment variables or 
the idea that your application holds sway over which version of Java or other 
third party components will be used.

Hope this helps,
Davide Bolcioni
-- 
There is no place like /home.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]