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

Re: Setting Env Variables | RPM



On Tue, Jan 30, 2007 at 11:25:45AM +0530, 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.

A process can't change other processes's environment, only its own, that
gets replicated to new children.

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

Add /etc/profile.d/java.sh and /etc/profile.d/java.csh to the rpm
package. The first file sets the environment for bourne like shells,
the second for C shells.

Examples for both:
/etc/profile.d/java.sh:
export JAVA_HOME=/usr/java/j2sdk1.4.2_12
export PATH=$JAVA_HOME/bin:$PATH

/etc/profile.d/java.csh:
setenv JAVA_HOME /usr/java/j2sdk1.4.2_12
set path = ( $JAVA_HOME/bin $path )

Afterwards, new shells with get the new JAVA_HOME

-- 
lfr
0/0

Attachment: pgpkJim4Cx1ti.pgp
Description: PGP signature


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