LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Gentoo (http://www.linuxquestions.org/questions/gentoo-87/)
-   -   How do I set the correct path in Gentoo Prefix? (http://www.linuxquestions.org/questions/gentoo-87/how-do-i-set-the-correct-path-in-gentoo-prefix-4175421417/)

nokangaroo 08-10-2012 10:39 AM

How do I set the correct path in Gentoo Prefix?
 
/etc/profile and /etc/bash/bashrc do not seem to work. When I enter the prefix (I am on Mac OS X, and my $EPREFIX is /opt/Gentoo), echo $PATH gives:

/opt/local/bin:/opt/local/sbin:/opt/Gentoo/usr/bin:/opt/Gentoo/bin:/opt/Gentoo/opt/bin:/opt/Gentoo/usr/sbin:/opt/Gentoo/sbin:/opt/Gentoo/usr/x86_64-apple-darwin10/gcc-bin/4.2.1:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/X11R6/bin:/sw/bin:/sw/sbin

Notice that the first two are doubled. But what I want is

export PATH=/opt/Gentoo/usr/bin:/opt/Gentoo/bin:/opt/Gentoo/opt/bin:/opt/Gentoo/usr/sbin:/opt/Gentoo/sbin:/opt/Gentoo/usr/x86_64-apple-darwin10/gcc-bin/4.2.1:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/X11R6/bin:/sw/bin:/sw/sbin

So where do I put this command to make it stick? As I said, putting it into /opt/Gentoo/etc/profile or /opt/Gentoo/etc/bash/bashrc (or both) does not work. Creating a file /opt/Gentoo/etc/bashrc (a copy of /opt/Gentoo/etc/bash/bashrc) or putting the export command in the startprefix script does not work either.


Edit: The problem is that /opt/Gentoo/etc/profile is not sourced, which seems like a bug to me. If I enter

Code:

. /opt/Gentoo/etc/profile
in the Prefix shell, then echo $PATH gives the correct setting.
But how do I modify the environment if I cannot use /etc/profile?

nokangaroo 08-10-2012 12:23 PM

Solved - created user folder in $EPREFIX

Code:

mkdir -p /opt/Gentoo/home/$USER
touch /opt/Gentoo/home/$USER/.bashrc
echo ". /opt/Gentoo/etc/profile" >> /opt/Gentoo/home/$USER/.bashrc

I added the following to /opt/Gentoo/etc/bash/bashrc:

Code:

unset PATH
export PATH=/opt/Gentoo/usr/bin:/opt/Gentoo/bin:/opt/Gentoo/opt/bin:/opt/Gentoo/usr/sbin:/opt/Gentoo/sbin:/opt/Gentoo/usr/x86_64-apple-darwin10/gcc-bin/4.2.1:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/X11R6/bin:/sw/bin:/sw/sbin

The funny thing is that my prefix home folder is in /home, but the prompt in the prefix shell reads /Users. It seems to work, but I expect more funkiness. Gentoo prefix is weird, dude.

Edit: I forgot to mention that I also edited the startprefix script; the env -i line now reads

Code:

env -i HOME=${EPREFIX}/home/${USER} TERM=$TERM USER=$USER $SHELL -l
Edit: If I want to start the prefix shell in my home folder I can append

Code:

cd ~
to my ${EPREFIX}/etc/bash/bashrc, but this is still weird because it shouldn't be necessary.


All times are GMT -5. The time now is 09:34 PM.