Installing Bash

Installation of Bash

Install Bash by running the following commands:



./configure --enable-static-link --prefix=$LFS/usr \
   --bindir=$LFS/bin --disable-nls --with-curses &&
make &&
make install &&
cd $LFS/bin &&
ln -s bash sh

If you get errors when compiling bash that tell you about not being able to find "-lcurses" run these two commands to create the missing symlink (so far we have not enountered one distribution that has this libncurses symlink setup properly, except for LFS systems where it is setup properly):



cd /usr/lib &&
ln -s libncurses.a libcurses.a

Note: Normally the libncurses.a file resides in the /usr/lib directory but it might reside in /lib (like it does on LFS systems). So check to make sure whether you should run the ln command in /usr/lib or in /lib

Command explanations

--enable-static-link: This configure option causes Bash to be linked statically

--prefix=$LFS/usr: This configure option installs all of Bash's files under the $LFS/usr directory, which becomes the /usr directory after you chroot into $LFS or when you reboot the system into LFS.

--bindir=$LFS/bin: This installs the executable files in $LFS/bin. We do this because we want bash to be in /bin, not in /usr/bin. One reason being: your /usr partition might be on a seperate partition which has to be mounted at some point. Before that partition is mounted you need and will want to have bash available (it will be hard to execute the boot scripts without a shell for instance).

--disable-nls: This disables the build of NLS (National Language Support). It's only a waste of time for now as Bash will be reinstalled in the next chapter.

--with-curses: This causes Bash to be linked against the curses library instead of the default termcap library which is becoming obsolete.

ln -s bash sh: This command creates the sh symlink that points to bash. Most scripts run themselves via 'sh' (invoked by the #!/bin/sh as the first line in the scripts) which invokes a special bash mode. Bash will then behave (as closely as possible) as the original Bourne shell.

The &&'s at the end of every line cause the next command only to be executed when the previous command exists with a return value of 0 indicating success. In case you copy&paste all of these commands on the shell you want to be ensured that if ./configure fails, make isn't being executed and likewise if make fails that make install isn't being executed, and so forth.

Contents

The Bash package contains the bash program

Description

Bash is the Bourne-Again SHell, which is a widely used command interpreter on Unix systems. Bash is a program that reads from standard input, the keyboard. You type something and the program will evaluate what you have typed and do something with it, like running a program.