You are not logged in.

#1 2012-03-13 11:57:06

zebulon
Member
Registered: 2008-10-20
Posts: 372

[Solved] Sourcing environment variable leads to a difficulty

Hi,

I maintain an AUR PKGBUILD (aacskeys) that installs first as a depends the meta package java-environement, which offers either jdk7-openjdk or openjdk6 (to the user's choice). My problem is that I need to access $JAVA_HOME before I build my package. When the java-environement is installed (assuming it is the first time), JAVA_HOME is not yet set in bash. There are scripts in /etc/profile.d that set it, but they are only run after reboot, which means the PKGBUILD fails if java was not already installed on the machine. Furthermore, depending on the chosen java, the script name differs, which means I cannot be sure which script to source to set JAVA_HOME.

So how can I source a file that will set JAVA_HOME when I do not know exactly which file sets JAVA_HOME in /etc/profile.d? Is it safe to source all files in /etc/profile.d at any time (using "source /etc/profile.d/*")? Or is there a command, or a clever trick to do this?

EDIT: I did further research. Is this command safe during PKGBUILD execution: "source /etc/profile" ?

Thanks,
Zeb

Last edited by zebulon (2012-03-14 07:14:50)

Offline

#2 2012-03-13 12:31:32

the.ridikulus.rat
Member
From: Indiana, USA
Registered: 2011-10-04
Posts: 765

Re: [Solved] Sourcing environment variable leads to a difficulty

AFAIK "source /etc/profile" should work in your case.

Offline

#3 2012-03-13 13:08:53

zebulon
Member
Registered: 2008-10-20
Posts: 372

Re: [Solved] Sourcing environment variable leads to a difficulty

Thank you.

Offline

Board footer

Powered by FluxBB