Installing Coreutils-&coreutils-version;
The Coreutils package contains utilities for showing and setting the
basic system characteristics.
&buildtime; &coreutils-time;
&diskspace; &coreutils-compsize;
&aa-coreutils-down;
&aa-coreutils-dep;
Installation of Coreutils
Apply the same Posixver patch we used previously:
patch -Np1 -i ../&coreutils-posixver-patch;
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-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-hostname-patch;
Now prepare Coreutils for compilation:
./configure --prefix=/usr
Compile the package:
make
The test suite of Coreutils makes several assumptions about the presence
of files and users that aren't valid yet this early in the LFS build. We will
therefore have to set up a few things before being able to run the tests. If
you choose not to run these tests, skip down to "Install the package".
First create a 'table of mounted filesystems' file with:
touch /etc/mtab
And 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
Now you're all set to run the test suite. First run the few tests that
are meant to be run as root:
make check-root
Then run the remainder of the tests as the dummy
user:
src/su dummy -c "make RUN_EXPENSIVE_TESTS=yes check"
The above command uses the newly compiled src/su
program, since in we didn't bother to
install it, because installing it requires root privileges.
When you're done testing, remove the dummy user and groups:
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/{date,echo,false,head,install,ln,ls} /bin
mv /usr/bin/{mkdir,mknod,mv,pwd,rm,rmdir,sync} /bin
mv /usr/bin/{sleep,stty,su,test,touch,true,uname} /bin
mv /usr/bin/chroot /usr/sbin
We'll be using the kill program from the Procps
package (installed as /bin/kill later in the chapter).
Remove the one installed by Coreutils:
rm /usr/bin/kill
Finally, create two symlinks to be FHS-compliant:
ln -s test /bin/[
ln -s ../../bin/install /usr/bin
&aa-coreutils-shortdesc;
&aa-coreutils-desc;