Installing Bash-2.05

Estimated build time:           3 minutes 
Estimated required disk space:  20 MB

Installation of Bash

Before you attempt to install Bash, you have to check to make sure your distribution has the /usr/lib/libcurses.a and /usr/lib/libncurses.a files. If your host distribution is an LFS system, all files will be present if you followed the instructions of the book version you read exactly.

If both of the files are missing, you have to install the ncurses development package. This package is often call something like ncurses-dev. If this package is already installed, or you just did it, check for the two files again. Often the libcurses.a file is (still) missing. If so, then create libcurses.a as a symlink by running the following commands:

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

Now we can continue. Install Bash by running the following commands:

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

If the make install phase ends with something along the lines of

install-info: unknown option `--dir-file=/mnt/lfs/usr/info/dir' 
usage: install-info [--version] [--help] [--debug] [--maxwidth=nnn] 
	[--section regexp title] [--infodir=xxx] [--align=nnn] 
	[--calign=nnn] [--quiet] [--menuentry=xxx]
	[--info-dir=xxx] 
	[--keep-old] [--description=xxx] [--test]
	[--remove] [--] filename 
make[1]: *** [install] Error 1 
make[1]: Leaving directory `/mnt/lfs/usr/src/bash-2.05/doc' 
make: [install] Error 2 (ignored)

then that means that you are probably using Debian, and that you have an old version of the texinfo package. This error is not severe by any means: the info pages will be installed when we recompile bash dynamically in chapter 6, so you can ignore it.

When we tested it with the latest Debian version, the last two commands were executed because the install process didn't return with a value larger than 0. But you would do good to check if you have the $LFS/bin/sh symlink on your LFS partition. If not, run the last two commands manually now.

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 the user chroot'ed into $LFS or when he rebooted 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: the /usr partition might be on a separate 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).

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

It is not strictly necessary for the static bash to be linked against libncurses (it can link against a static termap for the time being just fine because we will reinstall Bash in chapter 6 anyways, where we will use libncurses), but it's a good test to make sure that the ncurses package has been installed properly. If not, you will get in trouble later on in this chapter when you install the Texinfo package. That package requires ncurses and termcap can't reliably be used there.

ln -sf 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 to be executed only if the previous command exists with a return value of 0 indicating success. In case all of these commands are copy&pasted on the shell, is is important 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. A user types something and the program will evaluate what he has typed and do something with it, like running a program.

Dependencies

Bash-2.05 needs the following to be installed:


sh from the bash package

ar from the binutils package
as from the binutils package
ld from the binutils package
size from the binutils package

cmp from the diffutils package

chmod from the fileutils package
cp from the fileutils package
ls from the fileutils package
mv from the fileutils package

rm from the fileutils package

cc from the gcc package

egrep from the grep package
grep from the grep package

make from the make package

sed from the sed package

basename from the sh-utils package
echo from the sh-utils package
expr from the sh-utils package
uname from the sh-utils package

cat from the textutils package
tr from the textutils package