So, the common approach for sourcing ROOT seems to be just including
source /path/to/root/bin/thisroot.sh
in your ~/.bashrc
I was thinking that in order for it to work for all users, you could do the same in /etc/bash.bashrc (but that doesn’t seem to work). And that for it to work also when accessing the computer via SSH, you could do the same in /etc/environment. Neither of these options, however, seem to work for me, and I’m at my wits’ end.
How have/would you solve this? I want to set the machine up so that all users always can launch the “current” ROOT version (which would then be defined in e.g. /etc/bash.bashrc or /etc/environment).
I’m doing version installations under /opt; e.g. /opt/root-6.10.02, and then I thought I can just set up aliases for the different version (if I can only get this bit to work). I’m thinking that having users install different versions under /usr or /home will lead to several instances of the same version.
Edit: Apparently I didn’t read the full post, will go through it soon. I only got the shortened version when I tried to open the link on my mobile device.
That’s more or less what I say, too.
Just do NOT put any “default ROOT” settings in any standard “environment” files.
Every user should always be expected to source an appropriate “thisroot.[c]sh” for the ROOT version that [s]he wants to use.
Note: you can easily create shell aliases for them (and put them in any standard “environment” files) … something like:
alias root-53436='source /opt/ROOT/releases/root_v5.34.36/bin/thisroot.sh'
alias root-60902='source /opt/ROOT/releases/root_v6.09.02/bin/thisroot.sh'
alias root-61004='source /opt/ROOT/releases/root_v6.10.04/bin/thisroot.sh'
alias root-old="root-53436"
alias root-pro="root-60902"
alias root-new="root-61004"
alias root-dev="root-61004"
alias root-5="root-old"
alias root-6="root-new"
Actually, I myself do not put any “default ROOT” settings in any of my private “${HOME}/.profile”, “${HOME}/.bashrc” (and so on) files. I always call one of the above aliases in every [x]terminal in which I want to use ROOT.
BTW. My “original post” contains advices how to “configure” ROOT but they are quite old and suited for ROOT 5 and early versions of ROOT 6 (but not really for newer ROOT 6 versions).
$> mkdir -p foo/bin
$> cd foo
$> cat > .envrc
export FOO=`pwd`
export PATH=$FOO/bin:$PATH
^C
## do the following only once
$> direnv allow .
$> echo $FOO
/home/binet/foo
no need for special privileges (like installing environment-modules.)