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:~$ ".

And, /etc/bash.bashrc in Ubuntu 10.04 also sets some other bash behavior, such 
as: update value of $LINES and $COLUMNS, give sudo hint, give the hint when 
can't find a command, etc... I hope these will not affect a clear LFS building 
environment :-(

And, /etc/profile will invoke /etc/bash.bashrc in Ubuntu 10.04.

I think, $PS1 is a display style for the user interact with bash, set it in the 
~/.bashrc maybe a good idea? Under Ubuntu 10.04, I found the ~/.bashrc also 
overwrite the $PS1 value in its /etc/bash.bashrc.

Below is the content of /etc/bash.bashrc in Ubuntu 10.04:
<code>
# System-wide .bashrc file for interactive bash(1) shells.

# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, overwrite the one in /etc/profile)
PS1='${debian_chroot:+($debian_chroot)}...@\h:\w\$ '

# Commented out, don't overwrite xterm -T "title" -n "icontitle" by default.
# If this is an xterm set the title to user at host:dir
#case "$TERM" in
#xterm*|rxvt*)
#    PROMPT_COMMAND='echo -ne "\033]0;${us...@${hostname}: ${PWD}\007"'
#    ;;
#*)
#    ;;
#esac

# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
#    . /etc/bash_completion
#fi

# sudo hint
if [ ! -e "$HOME/.sudo_as_admin_successful" ]; then
    case " $(groups) " in *\ admin\ *)
    if [ -x /usr/bin/sudo ]; then
        cat <<-EOF
        To run a command as administrator (user "root"), use "sudo <command>".
        See "man sudo_root" for details.
        
        EOF
    fi
    esac
fi

# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found ]; then
        function command_not_found_handle {
                # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
                   /usr/bin/python /usr/lib/command-not-found -- $1
                   return $?
                elif [ -x /usr/share/command-not-found ]; then
                   /usr/bin/python /usr/share/command-not-found -- $1
                   return $?
                else
                   return 127
                fi
        }
fi
</code>

-- 
littlebat <dashing.m...@gmail.com>
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to