Re: Setting Env Variables | RPM

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

 



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: pgpXUa7stmpaF.pgp
Description: PGP signature

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux