Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Architectures & Platforms Gentoo for Mac OS X (Portage for Mac OS X)
  • Search

[SOLVED] should startprefix read prefixed etc/profile?

Running Portage on Mac OS X and need help with a problem? Post here.
Locked
Advanced search
10 posts • Page 1 of 1
Author
Message
tallest
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 145
Joined: Tue Mar 09, 2004 5:46 am
Location: Socorro, NM, USA

[SOLVED] should startprefix read prefixed etc/profile?

  • Quote

Post by tallest » Sun Jul 08, 2007 4:10 pm

The bootstrap documentation suggests using a script called startprefix created with the bootstrap script:

Code: Select all

$ 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?
Last edited by tallest on Mon Jul 09, 2007 8:15 pm, edited 2 times in total.
Those who can make you believe in absurdities can make you commit atrocities. --Voltaire
Top
didymos
Advocate
Advocate
User avatar
Posts: 4798
Joined: Mon Oct 10, 2005 2:09 am
Location: California

  • Quote

Post by didymos » Mon Jul 09, 2007 12:38 am

Why not just source it manually?
Thomas S. Howard
Top
tallest
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 145
Joined: Tue Mar 09, 2004 5:46 am
Location: Socorro, NM, USA

  • Quote

Post by tallest » Mon Jul 09, 2007 1:00 am

Any recommendations on how to do this?

If I just try

Code: Select all

$ ~/Library/Gentoo/bin/bash --init-file ~/Library/Gentoo/etc/profile
bash doesn't source ~/.bashrc.

If I try

Code: Select all

$ ~/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
Top
didymos
Advocate
Advocate
User avatar
Posts: 4798
Joined: Mon Oct 10, 2005 2:09 am
Location: California

  • Quote

Post by didymos » Mon Jul 09, 2007 3:06 am

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: Select all

~/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: Select all

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
Top
tallest
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 145
Joined: Tue Mar 09, 2004 5:46 am
Location: Socorro, NM, USA

  • Quote

Post by tallest » Mon Jul 09, 2007 4:24 am

Yeah, all startprefix does is reset $SHELL and run

Code: Select all

~/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: Select all

./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: Select all

$ ./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
Top
didymos
Advocate
Advocate
User avatar
Posts: 4798
Joined: Mon Oct 10, 2005 2:09 am
Location: California

  • Quote

Post by didymos » Mon Jul 09, 2007 6:00 am

OK, in /etc/profile is this comment:
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: Select all

# /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
Top
tallest
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 145
Joined: Tue Mar 09, 2004 5:46 am
Location: Socorro, NM, USA

  • Quote

Post by tallest » Mon Jul 09, 2007 4:28 pm

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

Code: Select all

# 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
Top
tallest
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 145
Joined: Tue Mar 09, 2004 5:46 am
Location: Socorro, NM, USA

  • Quote

Post by tallest » Mon Jul 09, 2007 8:17 pm

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
Top
didymos
Advocate
Advocate
User avatar
Posts: 4798
Joined: Mon Oct 10, 2005 2:09 am
Location: California

  • Quote

Post by didymos » Mon Jul 09, 2007 8:20 pm

Well, what was the fix?
Thomas S. Howard
Top
tallest
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 145
Joined: Tue Mar 09, 2004 5:46 am
Location: Socorro, NM, USA

  • Quote

Post by tallest » Tue Jul 10, 2007 2:28 am

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
Top
Locked

10 posts • Page 1 of 1

Return to “Gentoo for Mac OS X (Portage for Mac OS X)”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy