| 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
 | 
|---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
 | 
|---|
| 3 |   "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
 | 
|---|
| 4 |   <!ENTITY % general-entities SYSTEM "../../general.ent">
 | 
|---|
| 5 |   %general-entities;
 | 
|---|
| 6 | ]>
 | 
|---|
| 7 | 
 | 
|---|
| 8 | <sect1 id="ch-boot-creatingdirs">
 | 
|---|
| 9 |   <?dbhtml filename="creatingdirs.html"?>
 | 
|---|
| 10 | 
 | 
|---|
| 11 |   <title>Creating Directories</title>
 | 
|---|
| 12 | 
 | 
|---|
| 13 |   <para os="a">It is time to create some structure in the LFS file system. Create a
 | 
|---|
| 14 |   standard directory tree by issuing the following commands:</para>
 | 
|---|
| 15 | 
 | 
|---|
| 16 | <screen><userinput>install -d ${LFS}/{bin,boot,dev,etc/opt,home,lib,mnt}
 | 
|---|
| 17 | install -d ${LFS}/{sbin,srv,usr/local,var,opt,proc,sys}
 | 
|---|
| 18 | install -d ${LFS}/root -m 0750
 | 
|---|
| 19 | install -d ${LFS}/tmp ${LFS}/var/tmp -m 1777
 | 
|---|
| 20 | install -d ${LFS}/media/{floppy,cdrom}
 | 
|---|
| 21 | install -d ${LFS}/usr/{bin,include,lib,sbin,share,src}
 | 
|---|
| 22 | ln -s share/{man,doc,info} ${LFS}/usr
 | 
|---|
| 23 | install -d ${LFS}/usr/share/{doc,info,locale,man}
 | 
|---|
| 24 | install -d ${LFS}/usr/share/{misc,terminfo,zoneinfo}
 | 
|---|
| 25 | install -d ${LFS}/usr/share/man/man{1,2,3,4,5,6,7,8}
 | 
|---|
| 26 | install -d ${LFS}/usr/local/{bin,etc,include,lib,sbin,share,src}
 | 
|---|
| 27 | ln -s share/{man,doc,info} ${LFS}/usr/local
 | 
|---|
| 28 | install -d ${LFS}/usr/local/share/{doc,info,locale,man}
 | 
|---|
| 29 | install -d ${LFS}/usr/local/share/{misc,terminfo,zoneinfo}
 | 
|---|
| 30 | install -d ${LFS}/usr/local/share/man/man{1,2,3,4,5,6,7,8}
 | 
|---|
| 31 | install -d ${LFS}/var/{lock,log,mail,run,spool}
 | 
|---|
| 32 | install -d ${LFS}/var/{opt,cache,lib/{misc,locate},local}
 | 
|---|
| 33 | install -d ${LFS}/opt/{bin,doc,include,info}
 | 
|---|
| 34 | install -d ${LFS}/opt/{lib,man/man{1,2,3,4,5,6,7,8}}</userinput></screen>
 | 
|---|
| 35 | 
 | 
|---|
| 36 |   <para os="b">Directories are, by default, created with permission mode 755,
 | 
|---|
| 37 |   but this is not desirable for all directories. In the commands above,
 | 
|---|
| 38 |   two changes are made—one to the home directory of user
 | 
|---|
| 39 |   <systemitem class="username">root</systemitem>, and another to the
 | 
|---|
| 40 |   directories for temporary files.</para>
 | 
|---|
| 41 | 
 | 
|---|
| 42 |   <para os="c">The first mode change ensures that not just anybody can enter
 | 
|---|
| 43 |   the <filename class="directory">${LFS}/root</filename> directory—the
 | 
|---|
| 44 |   same as a normal user would do with his or her home directory. The
 | 
|---|
| 45 |   second mode change makes sure that any user can write to the
 | 
|---|
| 46 |   <filename class="directory">${LFS}/tmp</filename> and
 | 
|---|
| 47 |   <filename class="directory">${LFS}/var/tmp</filename> directories, but
 | 
|---|
| 48 |   cannot remove another user's files from them. The latter is prohibited
 | 
|---|
| 49 |   by the so-called <quote>sticky bit,</quote> the highest bit (1) in the
 | 
|---|
| 50 |   1777 bit mask.</para>
 | 
|---|
| 51 | 
 | 
|---|
| 52 |   <sect2 os="d">
 | 
|---|
| 53 |     <title>FHS Compliance Note</title>
 | 
|---|
| 54 | 
 | 
|---|
| 55 |     <para>The directory tree is based on the Filesystem Hierarchy Standard
 | 
|---|
| 56 |     (FHS) (available at <ulink url="http://www.pathname.com/fhs/"/>). In
 | 
|---|
| 57 |     addition to the tree created above, this standard stipulates the
 | 
|---|
| 58 |     existence of <filename class="directory">/usr/local/games</filename>
 | 
|---|
| 59 |     and <filename class="directory">/usr/share/games</filename>. The FHS
 | 
|---|
| 60 |     is not precise as to the structure of the <filename
 | 
|---|
| 61 |     class="directory">/usr/local/share</filename> subdirectory, so we
 | 
|---|
| 62 |     create only the directories that are needed. However, feel free to
 | 
|---|
| 63 |     create these directories if you prefer to conform more strictly to
 | 
|---|
| 64 |     the FHS.</para>
 | 
|---|
| 65 | 
 | 
|---|
| 66 |   </sect2>
 | 
|---|
| 67 | 
 | 
|---|
| 68 | </sect1>
 | 
|---|