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