Tagging 1.99.1
[linux_from_scratch.git] / newxml / chapter06 / coreutils.xml
blob37c0ed77f5489d9415825444d146f7c924244fb1
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3CR2//EN" "http://www.docbook.org/xml/4.3CR2/docbookx.dtd" [
3   <!ENTITY % coreutils-entities SYSTEM "../ent/coreutils.ent">
4   %coreutils-entities;
5 ]>
6 <sect1 id="ch06-coreutils">
7 <title>Installing Coreutils-&coreutils-version;</title>
8 <?dbhtml filename="coreutils.html"?>
10 <screen>Estimated build time:           0.9 SBU
11 Estimated required disk space:  69 MB</screen>
13 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../appendixa/coreutils-contents.xml"/>
17 <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../appendixa/coreutils-deps.xml"/>
21 <sect2>
22 <title>Installation of Coreutils</title>
24 <para>Normally the functionality of <userinput>uname</userinput> is somewhat
25 broken, in that the <userinput>-p</userinput> switch always returns "unknown".
26 The following patch fixes this behaviour for Intel architectures:</para>
28 <screen><userinput>patch -Np1 -i ../coreutils-&coreutils-version;-uname.patch</userinput></screen>
30 <para>We do not want Coreutils to install its version of the
31 <userinput>hostname</userinput> program, because it is inferior to the version
32 provided by Net-tools. Prevent its installation by applying a patch:</para>
34 <screen><userinput>patch -Np1 -i ../coreutils-&coreutils-version;-hostname-2.patch</userinput></screen>
36 <para>Now prepare Coreutils for compilation:</para>
38 <screen><userinput>./configure --prefix=/usr</userinput></screen>
40 <para>Compile the package:</para>
42 <screen><userinput>make</userinput></screen>
44 <para>The <userinput>su</userinput> program from Coreutils wasn't installed in
45 Chapter 5 because it needed <emphasis>root</emphasis> privilege to do so. We're
46 going to need it in a few moments for the test suite. Therefore we work around
47 the problem by installing it now:</para>
49 <screen><userinput>make install-root</userinput></screen>
51 <para>This package has a test suite available which can perform a number of
52 checks to ensure it built correctly. However, this particular test suite
53 makes some assumptions with regards to the presence of non-root users and
54 groups that don't apply this early into the LFS build. We therefore create
55 a dummy system user and two dummy groups to allow the tests to run
56 properly. Should you choose not to run the test suite, skip down to
57 "Install the package".  The following commands will prepare us for the test
58 suite. Create two dummy groups and a dummy user name:</para>
60 <screen><userinput>echo "dummy1:x:1000" &gt;&gt; /etc/group
61 echo "dummy2:x:1001:dummy" &gt;&gt; /etc/group
62 echo "dummy:x:1000:1000:::/bin/bash" &gt;&gt; /etc/passwd</userinput></screen>
64 <para>Some tests are meant to run as <emphasis>root</emphasis>:</para>
66 <screen><userinput>make check-root</userinput></screen>
68 <para>The remainder of the tests are run as the <emphasis>dummy</emphasis>
69 user:</para>
71 <screen><userinput>su dummy -c "make RUN_EXPENSIVE_TESTS=yes check"</userinput></screen>
73 <para>Remove the dummy groups and user name:</para>
75 <screen><userinput>sed -i.bak '/dummy/d' /etc/passwd /etc/group</userinput></screen>
77 <para>Install the package:</para>
79 <screen><userinput>make install</userinput></screen>
81 <para>And move some programs to their proper locations:</para>
83 <screen><userinput>mv /usr/bin/{basename,cat,chgrp,chmod,chown,cp,dd,df} /bin
84 mv /usr/bin/{date,echo,false,head,install,ln,ls} /bin
85 mv /usr/bin/{mkdir,mknod,mv,pwd,rm,rmdir,sync} /bin
86 mv /usr/bin/{sleep,stty,su,test,touch,true,uname} /bin
87 mv /usr/bin/chroot /usr/sbin</userinput></screen>
89 <para>We'll be using the <filename>kill</filename> program from the Procps
90 package (installed as <filename>/bin/kill</filename> later in the chapter).
91 Remove the one installed by Coreutils:</para>
93 <screen><userinput>rm /usr/bin/kill</userinput></screen>
95 <para>Finally, create a few necessary symlinks:</para>
97 <screen><userinput>ln -s test /bin/[
98 ln -s ../../bin/install /usr/bin</userinput></screen>
100 </sect2>
102 </sect1>