Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm building my own Linux distribution with Linux From Scratch, and I'm having a bit of a problem getting started. I created the LFS user, group, and directories, but I'm having trouble getting /bin/bash to work as it does on my main user. In Fedora 6, the terminal prompt is like this:
Code:
[me@localhost ~]$
With user "lfs" set to use /bin/bash (the same as my username on FC6) the terminal prompt looks like this:
Code:
lfs:~$
It doesn't sound like much of a problem, but in my username I can tell what are files and what are folders by the color it's listed as, and it's black and white here. So I decided to try /bin/csh instead of /bin/bash, since it looks like what my main account is set as. Well it works, but for some reason the "export" command doesn't work. I tried a bunch of other commands off the top of my head, but they work. So my question is, why is /bin/bash different on separate users and why can I not use the export command?
Dear Sir, or Madam, since "JRR883" is not suggestive on this :-),
Your /bin/bash is NOT schizophrenic at all, it behaves exactly the way you want it to.
Well, let's take it step by step.
1. Should you have any further questions on building you Linux From Scratch [and you will, just like all the others, including myself], please post them in Forums > Linux > Linux - Distributions > LFS. THis way you have much more chances to get the answer.
2. About bash. In terminal, the command line prompt is controlled by a particular environment variable - PS1. It is set globally [for all users] in /etc/profile [more logical] or in /etc/bashrc [you can check this out on your system], but every user can set this variable to something different in ~/.bash_profile [morelogical] or in ~/.bashrc. You may want to check the value of PS1 by issuing
Code:
echo $PS1
while being logged in as different users. Further on, you can change it by simply editing the corresponding file.
3. About file colors. Usually, there's a script like /etc/profile.d/dircolors.sh, which takes care of this.
4. "export" doesn't work (?). Never heard of such problem, but you still can use "set" and "unset" instead, right?
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900
Rep:
It's property of FC more than of LFS... And I installed FC one time and killed immediately. Really, what is set there? PS* settings will do no harm. PATH can do some problems, either can LD_LIBRARY_PATH, alias for ls requiring colour on tty is harmless. So, what is there?
[lfs@localhost ~]$ cat /etc/bashrc
# /etc/bashrc
# System wide functions and aliases
# Environment stuff goes in /etc/profile
# By default, we want this to get set.
# Even for non-interactive, non-login shells.
umask 022
# are we an interactive shell?
if [ "$PS1" ]; then
case $TERM in
xterm*)
if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
else
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
fi
;;
screen)
if [ -e /etc/sysconfig/bash-prompt-screen ]; then
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
else
PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'
fi
;;
*)
[ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
;;
esac
# Turn on checkwinsize
shopt -s checkwinsize
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
fi
if ! shopt -q login_shell ; then # We're not a login shell
# Need to redefine pathmunge, it get's undefined at the end of /etc/profile
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
for i in /etc/profile.d/*.sh; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
unset pathmunge
fi
# vim:ts=4:sw=4
And PS1 is undefined on user lfs, but is defined as [\u@\h \W]\$ on user me.
If a mod sees this, please move it to the LFS forum. I'll probably be asking more LFS questions in this thread so I don't clutter up the front page.
Now onto my next issue: I have the symlink of ~/tools at /tools, and I configured bintools with the --prefix=/tools switch, but when I make install, mkdir complains about too many levels of symbolic links, as shown here:
Code:
[lfs@localhost binutils-2.16.1]$ make install
/bin/sh ./mkinstalldirs /tools /tools
mkdir -p -- /tools /tools
mkdir: `/tools': Too many levels of symbolic links
mkdir: `/tools': Too many levels of symbolic links
make: *** [installdirs] Error 1
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900
Rep:
About first - post lang.sh, less.sh, which-2.sh
About second: symlink - by definition - points to relative path written to it, so /tools points to tools as seen from it location. OOps, it points to itself. Create it with full path. It's tricky to learn that argument to ln is not the file link will point to, but text - or relative - relative to destination ! - path where link will point to.
[me@localhost profile.d]$ cat lang.sh
# /etc/profile.d/lang.sh - set i18n stuff
sourced=0
for langfile in /etc/sysconfig/i18n $HOME/.i18n ; do
[ -f $langfile ] && . $langfile && sourced=1
done
if [ -n "$GDM_LANG" ]; then
sourced=1
LANG="$GDM_LANG"
unset LANGUAGE
if [ "$GDM_LANG" = "zh_CN.GB18030" ]; then
export LANGUAGE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"
fi
fi
if [ "$sourced" = 1 ]; then
[ -n "$LANG" ] && export LANG || unset LANG
[ -n "$LC_ADDRESS" ] && export LC_ADDRESS || unset LC_ADDRESS
[ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
[ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
[ -n "$LC_IDENTIFICATION" ] && export LC_IDENTIFICATION || unset LC_IDENTIFICATION
[ -n "$LC_MEASUREMENT" ] && export LC_MEASUREMENT || unset LC_MEASUREMENT
[ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
[ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
[ -n "$LC_NAME" ] && export LC_NAME || unset LC_NAME
[ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
[ -n "$LC_PAPER" ] && export LC_PAPER || unset LC_PAPER
[ -n "$LC_TELEPHONE" ] && export LC_TELEPHONE || unset LC_TELEPHONE
[ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
if [ -n "$LC_ALL" ]; then
if [ "$LC_ALL" != "$LANG" ]; then
export LC_ALL
else
unset LC_ALL
fi
else
unset LC_ALL
fi
[ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
[ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
[ -n "$_XKB_CHARSET" ] && export _XKB_CHARSET || unset _XKB_CHARSET
consoletype=$(/sbin/consoletype)
if [ -n "$CHARSET" ]; then
case $CHARSET in
8859-1|8859-2|8859-5|8859-8|8859-15|koi*)
if [ "$TERM" = "linux" -a "$consoletype" = "vt" ]; then
echo -n -e '\033(K' 2>/dev/null > /proc/$$/fd/0
fi
;;
esac
elif [ -n "$SYSFONTACM" ]; then
case $SYSFONTACM in
iso01*|iso02*|iso05*|iso08*|iso15*|koi*|latin2-ucw*)
if [ "$TERM" = "linux" -a "$consoletype" = "vt" ]; then
echo -n -e '\033(K' 2>/dev/null > /proc/$$/fd/0
fi
;;
esac
fi
if [ -n "$LANG" ]; then
case $LANG in
*.utf8*|*.UTF-8*)
if [ "$TERM" = "linux" ]; then
if [ "$consoletype" = "vt" ]; then
case $LANG in
ja*) LANG=en_US.UTF-8 ;;
ko*) LANG=en_US.UTF-8 ;;
si*) LANG=en_US.UTF-8 ;;
zh*) LANG=en_US.UTF-8 ;;
en_IN*) ;;
*_IN*) LANG=en_US.UTF-8 ;;
esac
[ -x /bin/unicode_start ] && /sbin/consoletype fg && /bin/unicode_start $SYSFONT $SYSFONTACM
fi
fi
;;
*)
if [ "$TERM" = "linux" ]; then
if [ "$consoletype" = "vt" ]; then
case $LANG in
ja*) LANG=en_US ;;
ko*) LANG=en_US ;;
si*) LANG=en_US ;;
zh*) LANG=en_US ;;
en_IN*) ;;
*_IN*) LANG=en_US ;;
esac
[ -x /bin/unicode_stop ] && /sbin/consoletype fg && /bin/unicode_stop
fi
fi
;;
esac
fi
unset SYSFONTACM SYSFONT
fi
unset sourced
unset langfile
[me@localhost profile.d]$ cat less.sh
# less initialization script (sh)
[ -x /usr/bin/lesspipe.sh ] && export LESSOPEN="|/usr/bin/lesspipe.sh %s"
[me@localhost profile.d]$ cat which-2.sh
# Initialization script for bash and sh
# export AFS, if you are in AFS environment
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
Thanks, I got binutils built and installed. I'll remember to type the full path next time. This is fun! haha if that doesn't make me a geek, I don't know what does.
I tried changing the permissions, but I still got that error. I didn't try building it as root, though. That's generally a bad idea. Any idea on how to get around this?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.