On Fri, Jun 4, 2010 at 1:40 AM, littlebat <dashing.m...@gmail.com> wrote: > This issue was posted onto lfs-support mailing list yesterday (see: > http://linuxfromscratch.org/pipermail/lfs-support/2010-June/038814.html ), > unluckly I disabled the mail delivery of LFS mailing list some days ago, so I > can't continue discuss it on the lfs-support mailing list. And, I consider it > is a bug of LFS6.6 book, so I start a new thread on the lfs-dev list to > discuss it. > > I am using Ubuntu 10.04 as the LFS building host. When I set environment with > the instructions at: 4.4. Setting Up the Environment: > http://www.linuxfromscratch.org/lfs/view/6.6/chapter04/settingenvironment.html > , I found the commands provided by LFS book can't set $PS1 value under > Ubuntu 10.04 host properly. The commands is below: > > <code> > cat > ~/.bash_profile << "EOF" > exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash > EOF > </code> > > The issue is Ubuntu has a system-wide .bashrc file for interactive bash(1) > shells, it is /etc/bash.bashrc. $PS1 has been set to > PS1='${debian_chroot:+($debian_chroot)}...@\h:\w\$ ' in this file. When the > command above invoke "/bin/bash" to start a new interactive bash shells, > /etc/bash.bashrc will invoked first, this $PS1 value will be seted. So, $PS1 > keep as the format like "l...@u1004b2-desktop:~$ ", not the format excepted > by LFS6.6 book like "lfs:~$ ".
Looks like debian and ubuntu hosts have the SYS_BASHRC definition set, which will source /etc/bash.bashrc before ~/.bashrc on non-interactive logins. Seems like the easiest fix is to move the PS1 setting to ~lfs/.bashrc, but it probably doesn't affect anything to leave the ubuntu settings. On the other hand, the whole point of that setup is to get full control over the shell environment, and now you have arbitrary things being set from /etc/bash.bashrc. Probably the only true way to avoid this is to build your own bash and run it. The other way is to run the interactive shell with --posix and ENV set. cat > ~/.bash_profile << "EOF" exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' ENV=$HOME/.bashrc /bin/bash --posix EOF Of course, you lose all the nice bashisms, though. -- Dan -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page