View previous topic :: View next topic |
Author |
Message |
tallest Tux's lil' helper
Joined: 09 Mar 2004 Posts: 145 Location: Socorro, NM, USA
|
Posted: Sun Jul 08, 2007 4:10 pm Post subject: [SOLVED] should startprefix read prefixed etc/profile? |
|
|
The bootstrap documentation suggests using a script called startprefix created with the bootstrap script: Code: | $ cd $EPREFIX/usr/portage/scripts
$ ./bootstrap-prefix.sh $EPREFIX startscript | that will "will drop you into a prefix shell, where for example emerge is directly at your disposal".
I followed these instructions, but when I run startprefix the prefixed profile (~/Library/etc/profile) is never sourced. Thus my PATH isn't set and nothing from the prefix is at my disposal. Should the prefixed bash be reading my prefixed profile and bashrc? _________________ Those who can make you believe in absurdities can make you commit atrocities. --Voltaire
Last edited by tallest on Mon Jul 09, 2007 8:15 pm; edited 2 times in total |
|
Back to top |
|
|
didymos Advocate
Joined: 10 Oct 2005 Posts: 4798 Location: California
|
Posted: Mon Jul 09, 2007 12:38 am Post subject: |
|
|
Why not just source it manually? _________________ Thomas S. Howard |
|
Back to top |
|
|
tallest Tux's lil' helper
Joined: 09 Mar 2004 Posts: 145 Location: Socorro, NM, USA
|
Posted: Mon Jul 09, 2007 1:00 am Post subject: |
|
|
Any recommendations on how to do this?
If I just try Code: | $ ~/Library/Gentoo/bin/bash --init-file ~/Library/Gentoo/etc/profile | bash doesn't source ~/.bashrc.
If I try Code: | $ ~/Library/Gentoo/bin/bash --init-file ~/Library/Gentoo/etc/profile -c 'source ~/.bashrc' | ~/.bashrc still isn't sourced.
I'd prefer not to put it into my ~/.bashrc as I'd like that to be the last thing sourced.
Thanks ,
Aaron _________________ Those who can make you believe in absurdities can make you commit atrocities. --Voltaire |
|
Back to top |
|
|
didymos Advocate
Joined: 10 Oct 2005 Posts: 4798 Location: California
|
Posted: Mon Jul 09, 2007 3:06 am Post subject: |
|
|
Is ~/.bashrc executable? Also, when you specify --init-file, it overrides the normal "read ~/.bashrc" behavior. What I meant was to execute the shell, then at the prompt do "source ~/Library/Gentoo/etc/profile", and see if that sets the env stuff you need. I don't think the order in which things are sourced is going to matter much. Is the startprefix script very long? If not, I wouldn't mind having a look at it. You could also try executing bash like so:
Code: |
~/Library/Gentoo/bin/bash -l
|
which will make it behave like a login shell. The -c option is usually used for noninteractive purposes. If you do:
Code: | bash -c 'echo "Hey, where all the white women at?"' |
it'll just print the line and exit, leaving you in your original shell. _________________ Thomas S. Howard |
|
Back to top |
|
|
tallest Tux's lil' helper
Joined: 09 Mar 2004 Posts: 145 Location: Socorro, NM, USA
|
Posted: Mon Jul 09, 2007 4:24 am Post subject: |
|
|
Yeah, all startprefix does is reset $SHELL and run Code: | ~/Library/Gentoo/bin/bash -l |
The problem is that the prefixed bash is not reading the prefixed etc/profile. Everything is fine if I source it myself, but I'd like to automate the process without modifying my ~/.bashrc or ~/.profile so that I can get into the default (non-Gentoo) environment easily without sourcing the prefixed profile.
This means that I need a command to launch the prefixed bash, followed by a source of the prefixed etc/profile and my ~/.bashrc. The other option is to add a source ~/.bashrc to the prefixed etc/profile and use the --init-file option.
My question still stands though, why doesn't the prefixed bash source the prefixed etc/profile. I've even tried compiling it myself with Code: | ./configure --prefix=/Users/wilson/Library/Gentoo --sysconfdir=/Users/wilson/Library/Gentoo/etc | but it still just sources /etc/profile. The configure script has this to say about the --sysconfdir option Code: | $ ./configure --help|grep sysconf
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] |
_________________ Those who can make you believe in absurdities can make you commit atrocities. --Voltaire |
|
Back to top |
|
|
didymos Advocate
Joined: 10 Oct 2005 Posts: 4798 Location: California
|
Posted: Mon Jul 09, 2007 6:00 am Post subject: |
|
|
OK, in /etc/profile is this comment:
Quote: |
if [ -f /etc/bash/bashrc ] ; then
# Bash login shells run only /etc/profile
# Bash non-login shells run only /etc/bash/bashrc
# Since we want to run /etc/bash/bashrc regardless, we source it
# from here. It is unfortunate that there is no way to do
# this *after* the user's .bash_profile runs (without putting
# it in the user's dot-files), but it shouldn't make any
# difference.
. /etc/bash/bashrc
|
What you want, I think, is to do the equivalent for the ~/ files. For bash, it's ~/bash_profile (although it will also look for .profile and .bash_login), and the default contents are:
Code: |
# /etc/skel/.bash_profile
# This file is sourced by bash for login shells. The following line
# runs your .bashrc and is recommended by the bash info pages.
[[ -f ~/.bashrc ]] && . ~/.bashrc
|
which is why I asked about .bashrc being executable. I still don't know why it refuses to read the prefixed etc/profile, but I'd just add the "--init-file ~/Library/Gentoo/etc/profile" to the startprefix script. Of course all this depends on the current contents of ~/.profile, so if it already has the command to run .bashrc in it, then I've just wasted your time (unless .bashrc isn't executable). _________________ Thomas S. Howard |
|
Back to top |
|
|
tallest Tux's lil' helper
Joined: 09 Mar 2004 Posts: 145 Location: Socorro, NM, USA
|
Posted: Mon Jul 09, 2007 4:28 pm Post subject: |
|
|
OK, I think I've found a kludge that seems to work. I was able to leave ~/Library/Gentoo/startprefix, /etc/profile, ~/Library/Gentoo/etc/profile, and ~/Library/Gentoo/etc/bash/bashrc in their original forms and added ~/.bashrc: | # if we are in the prefixed gentoo
if `echo $SHELL|grep Gentoo 1>/dev/null 2>&1` ; then
# source prefixed profile
source ${HOME}/Library/Gentoo/etc/profile
# fix color ls
alias ls='ls --color'
# disable bold in PS1
PS1=`echo $PS1|sed s/01\;/00\;/g`
PS1=$PS1' '
export PS1
fi | before I do anything else in my ~/.bashrc _________________ Those who can make you believe in absurdities can make you commit atrocities. --Voltaire |
|
Back to top |
|
|
tallest Tux's lil' helper
Joined: 09 Mar 2004 Posts: 145 Location: Socorro, NM, USA
|
Posted: Mon Jul 09, 2007 8:17 pm Post subject: |
|
|
An update: Fabian Groffen, of prefixed portage, has fixed the issue. The prefixed bash now sources the prefixed etc files as expected. There is no need for my hack.
Thanks,
Aaron _________________ Those who can make you believe in absurdities can make you commit atrocities. --Voltaire |
|
Back to top |
|
|
didymos Advocate
Joined: 10 Oct 2005 Posts: 4798 Location: California
|
Posted: Mon Jul 09, 2007 8:20 pm Post subject: |
|
|
Well, what was the fix? _________________ Thomas S. Howard |
|
Back to top |
|
|
tallest Tux's lil' helper
Joined: 09 Mar 2004 Posts: 145 Location: Socorro, NM, USA
|
Posted: Tue Jul 10, 2007 2:28 am Post subject: |
|
|
Fabian Groffen wrote: | On 09-07-2007 14:19:47 -0600, Aaron Wilson wrote:
> Thank you very much, it works as expected now. Out of curiosity, and so
> that your solution is googleable for anyone else who might run into this,
> what was the problem?
Due to some very wrong approach of patching files, I wiped out the
prefix patches, such that bash was compiled to be just a normal bash.
I now changed the approach to patch files, such that updates will either
just work or break the patch, alarming that something needs to be done.
--
Fabian Groffen
Gentoo on a different level
--
gentoo-alt@gentoo.org mailing list |
_________________ Those who can make you believe in absurdities can make you commit atrocities. --Voltaire |
|
Back to top |
|
|
|