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

Environment variables for Debian (e.g. JAVA_HOME, etc)



Hi,

I recently switched back from Debian to gentoo, after realizing that my
good old debian unstable was actually way less pain to maintain than my
super-bleeding-edge gentoo ;-)

However, I noticed some well-done framework on gentoo for which I
couldn't find a debian-equivalent : the env-update (/etc/env.d/*)
executable.

In fact, some packages usually need to place some environment variables
that should be set for all users. For example, the JAVA_HOME env. comes
to my mind, or the fact that the administrator may want every user to
automatically have $JAVA_HOME/bin in their $PATH.
(some applications are broken if JAVA_HOME is not set)

It looks like that under debian, the only way to go is by editing /etc/
profile, and manually adding export JAVA_HOME=whatever etc..

Under Gentoo, however, the jdk package installs a file under /etc/env.d/
java/20blackdown-jdk-1.4.2_rc1
which contains :
VERSION="Blackdown JDK 1.4.2_rc1"
JAVA_HOME=/opt/blackdown-jdk-1.4.2_rc1
JDK_HOME=/opt/blackdown-jdk-1.4.2_rc1
JAVAC=${JAVA_HOME}/bin/javac
ADDPATH="${JAVA_HOME}/bin:${JAVA_HOME}/jre/bin"
ADDLDPATH="${JAVA_HOME}/jre/lib/i386/:${JAVA_HOME}/jre/lib/i386/
native_threads/:${JAVA_HOME}/jre/lib/i386/classic/"
MANPATH=/opt/blackdown-jdk-1.4.2_rc1/man
ENV_VARS="JAVA_HOME JDK_HOME JAVAC ADDPATH ADDLDPATH MANPATH"


then, you can run env-update which updates /etc/profile.env which is
sourced by /etc/profile, so that every user has correct environment
settings.

OK, I guess you could argue that it doesn't work for all shells, etc,
but the framework could be made to work for bash first, then env-update
could also update 
/etc/profile.env.tcsh, /etc/profile.env.WhateverShell
etc..

So, has anyone already thought about this kind of stuff and decided that
it wasn't the right way to go ? if the answer is yes, what are the
reasons not to do such a beautiful thing ?

Thanks for your replies,
Sam

PS: please CC: me the answers since I'm not subscribed to debian-devel



Reply to: