1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
<sect1 id="ch-system-coreutils" xreflabel="Coreutils">
<title>Installing Coreutils-&coreutils-version;</title>
<?dbhtml filename="coreutils.html" dir="chapter06"?>
<para>The Coreutils package contains utilities for showing and setting the
basic system characteristics.</para>
<screen>&buildtime; &coreutils-time;
&diskspace; &coreutils-compsize;</screen>
&aa-coreutils-down;
&aa-coreutils-dep;
<sect2><title> </title><para> </para></sect2>
<sect2>
<title>Installation of Coreutils</title>
<para>Apply the same Posixver patch we used previously:</para>
<screen><userinput>patch -Np1 -i ../&coreutils-posixver-patch;</userinput></screen>
<para>Normally the functionality of <command>uname</command> is somewhat
broken, in that the <emphasis>-p</emphasis> switch always returns "unknown".
The following patch fixes this behaviour for Intel architectures:</para>
<screen><userinput>patch -Np1 -i ../&coreutils-uname-patch;</userinput></screen>
<para>We do not want Coreutils to install its version of the
<command>hostname</command> program, because it is inferior to the version
provided by Net-tools. Prevent its installation by applying a patch:</para>
<screen><userinput>patch -Np1 -i ../&coreutils-hostname-patch;</userinput></screen>
<para>Now prepare Coreutils for compilation:</para>
<screen><userinput>./configure --prefix=/usr</userinput></screen>
<para>Compile the package:</para>
<screen><userinput>make</userinput></screen>
<para>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".</para>
<para>To be able to run the full test suite, the <command>su</command> program
needs to be installed. We didn't bother to install this little program in
<xref linkend="chapter-temporary-tools"/> because it requires root privileges,
so do it now:</para>
<screen><userinput>make install-root</userinput></screen>
<para>Create a 'table of mounted filesystems' file with:</para>
<screen><userinput>touch /etc/mtab</userinput></screen>
<para>And create two dummy groups and a dummy user name:</para>
<screen><userinput>echo "dummy1:x:1000" >> /etc/group
echo "dummy2:x:1001:dummy" >> /etc/group
echo "dummy:x:1000:1000:::/bin/bash" >> /etc/passwd</userinput></screen>
<para>Now you're all set to run the test suite. First run the few tests that
are meant to be run as <emphasis>root</emphasis>:</para>
<screen><userinput>make check-root</userinput></screen>
<para>Then run the remainder of the tests as the <emphasis>dummy</emphasis>
user:</para>
<screen><userinput>su dummy -c "make RUN_EXPENSIVE_TESTS=yes check"</userinput></screen>
<para>When you're done testing, remove the dummy user and groups:</para>
<screen><userinput>sed -i.bak '/dummy/d' /etc/passwd /etc/group</userinput></screen>
<para>Install the package:</para>
<screen><userinput>make install</userinput></screen>
<para>And move some programs to their proper locations:</para>
<screen><userinput>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</userinput></screen>
<para>We'll be using the <filename>kill</filename> program from the Procps
package (installed as <filename>/bin/kill</filename> later in the chapter).
Remove the one installed by Coreutils:</para>
<screen><userinput>rm /usr/bin/kill</userinput></screen>
<para>Finally, create two symlinks to be FHS-compliant:</para>
<screen><userinput>ln -s test /bin/[
ln -s ../../bin/install /usr/bin</userinput></screen>
</sect2>
&aa-coreutils-shortdesc;
&aa-coreutils-desc;
</sect1>
|