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