[062461b] | 1 | <sect1 id="ch05-creatingdirs">
|
---|
| 2 | <title>Creating directories</title>
|
---|
| 3 | <?dbhtml filename="creatingdirs.html" dir="chapter05"?>
|
---|
| 4 |
|
---|
| 5 | <para>Let's now create the directory tree on the LFS partition based on
|
---|
| 6 | the FHS standard, which can be found at
|
---|
| 7 | <ulink url="http://www.pathname.com/fhs/">http://www.pathname.com/fhs/</ulink>.
|
---|
| 8 | Issuing the following commands will create a default directory layout:</para>
|
---|
| 9 |
|
---|
| 10 | <para><screen><userinput>cd $LFS &&
|
---|
| 11 | mkdir -p bin boot dev/pts etc/opt home lib mnt proc root sbin tmp var opt &&
|
---|
| 12 | for dirname in $LFS/usr $LFS/usr/local
|
---|
| 13 | <literal> do</literal>
|
---|
| 14 | mkdir $dirname
|
---|
| 15 | cd $dirname
|
---|
[3a25785] | 16 | mkdir bin etc include lib sbin share src
|
---|
[062461b] | 17 | ln -s share/man
|
---|
| 18 | ln -s share/doc
|
---|
| 19 | ln -s share/info
|
---|
| 20 | cd $dirname/share
|
---|
| 21 | mkdir dict doc info locale man nls misc terminfo zoneinfo
|
---|
| 22 | cd $dirname/share/man
|
---|
| 23 | mkdir man{1,2,3,4,5,6,7,8}
|
---|
| 24 | done &&
|
---|
| 25 | cd $LFS/var &&
|
---|
| 26 | mkdir -p lock log mail run spool tmp opt cache lib/misc local &&
|
---|
| 27 | cd $LFS/opt &&
|
---|
| 28 | mkdir bin doc include info lib man &&
|
---|
| 29 | cd $LFS/usr &&
|
---|
| 30 | ln -s ../var/tmp</userinput></screen></para>
|
---|
| 31 |
|
---|
| 32 | <para>Normally, directories are created with permission mode 755, which isn't
|
---|
| 33 | desired for all directories. The first change is a mode 0750 for the
|
---|
| 34 | $LFS/root directory. This is to make sure that not just everybody can
|
---|
| 35 | enter the /root directory (the same a user would do with /home/username
|
---|
| 36 | directories). The second change is a mode 1777 for the tmp
|
---|
| 37 | directories. This way, any user can write data to the /tmp or /var/tmp
|
---|
| 38 | directory but cannot remove another user's files (the latter is caused
|
---|
| 39 | by the so-called "sticky bit" - bit 1 of the 1777 bit mask).</para>
|
---|
| 40 |
|
---|
| 41 | <para><screen><userinput>cd $LFS &&
|
---|
| 42 | chmod 0750 root &&
|
---|
| 43 | chmod 1777 tmp var/tmp</userinput></screen></para>
|
---|
| 44 |
|
---|
| 45 | <para>Now that the directories are created, copy the source files that were
|
---|
| 46 | downloaded in chapter 3 to some subdirectory under $LFS/usr/src (you
|
---|
| 47 | will need to create the desired directory yourself).</para>
|
---|
| 48 |
|
---|
| 49 | <sect2>
|
---|
| 50 | <title>FHS compliance notes</title>
|
---|
| 51 |
|
---|
[6925e03] | 52 | <para>The FHS stipulates that the /usr/local directory should contain the
|
---|
| 53 | bin, games, include, lib, man, sbin, and share subdirectories. You can
|
---|
| 54 | alter your /usr/local directory yourself if you want your system to be
|
---|
| 55 | FHS-compliant.</para>
|
---|
[062461b] | 56 |
|
---|
| 57 | <para>Also, the standard says that there should exist a /usr/share/games
|
---|
| 58 | directory, which we don't much like for a base system. But feel free to
|
---|
| 59 | make your system FHS-compliant if you wish. The FHS isn't precise as
|
---|
| 60 | to the structure of the /usr/local/share subdirectories, so we took the
|
---|
[b04e759] | 61 | liberty of creating the directories that we felt were needed.</para>
|
---|
[062461b] | 62 |
|
---|
| 63 | </sect2>
|
---|
| 64 |
|
---|
| 65 | </sect1>
|
---|
| 66 |
|
---|