Installing Coreutils-5.0

Estimated build time:           0.9 SBU
Estimated required disk space:  69 MB

Contents of Coreutils

The Coreutils package contains a whole series of basic shell utilities.

(Last checked against version 5.0.)

Installed programs: basename, cat, chgrp, chmod, chown, chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, head, hostid, hostname, id, install, join, kill, link, ln, logname, ls, md5sum, mkdir, mkfifo, mknod, mv, nice, nl, nohup, od, paste, pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, rm, rmdir, seq, sha1sum, shred, sleep, sort, split, stat, stty, su, sum, sync, tac, tail, tee, test, touch, tr, true, tsort, tty, uname, unexpand, uniq, unlink, uptime, users, vdir, wc, who, whoami and yes

Coreutils Installation Dependencies

Not yet checked but probably something like this:

Bash: sh
Binutils: ar, as, ld, ranlib
Coreutils: basename, cat, chmod, chown, echo, expr, hostname,
             install, ls, mv, rm, sleep, tr, uname
Diffutils: cmp
Gawk: gawk
GCC: cc, cc1, collect2, cpp, gcc
Gettext: msgfmt, xgettext
Glibc: getconf
Grep: egrep, fgrep, grep
Make: make
Perl: perl
Sed: sed
Tar: tar
Texinfo: install-info, makeinfo

Installation of Coreutils

Normally the functionality of uname is somewhat broken, in that the -p switch always returns "unknown". The following patch fixes this behaviour for Intel architectures:

patch -Np1 -i ../coreutils-5.0-uname.patch

We do not want Coreutils to install its version of the hostname program, because it is inferior to the version provided by Net-tools. Prevent its installation by applying a patch:

patch -Np1 -i ../coreutils-5.0-hostname-2.patch

Now prepare Coreutils for compilation:

./configure --prefix=/usr

Compile the package:

make

The su program from Coreutils wasn't installed in Chapter 5 because it needed root privilege to do so. We're going to need it in a few moments for the test suite. Therefore we work around the problem by installing it now:

make install-root

This package has a test suite available which can perform a number of checks to ensure it built correctly. However, this particular test suite makes some assumptions that aren't quite valid at this early stage of Chapter 6. We therefore make a few adjustments to allow the tests to run properly. Should you choose not to run the test suite, skip down to "Install the package". The following commands will prepare us for the test suite. Create two dummy groups and a dummy user name:

echo "dummy1:x:1000" >> /etc/group
echo "dummy2:x:1001:dummy" >> /etc/group
echo "dummy:x:1000:1000:::/bin/bash" >> /etc/passwd

Some tests are meant to run as root:

make check-root

The remainder of the tests are run as the dummy user:

su dummy -c "make RUN_EXPENSIVE_TESTS=yes check"

Remove the dummy groups and user name:

sed -i.bak '/dummy/d' /etc/passwd /etc/group

Install the package:

make install

And move some programs to their proper locations:

mv /usr/bin/{basename,cat,chgrp,chmod,chown,cp,dd,df} /bin
mv /usr/bin/{dir,dircolors,du,date,echo,false,head} /bin
mv /usr/bin/{install,ln,ls,mkdir,mkfifo,mknod,mv,pwd} /bin
mv /usr/bin/{rm,rmdir,shred,sync,sleep,stty,su,test} /bin
mv /usr/bin/{touch,true,uname,vdir} /bin
mv /usr/bin/chroot /usr/sbin

Finally, create a few necessary symlinks:

ln -s test /bin/[
ln -s ../../bin/install /usr/bin