[6370fa6] | 1 | <sect1 id="ch04-creatingdirs">
|
---|
| 2 | <title>Creating directories</title>
|
---|
| 3 |
|
---|
| 4 | <para>
|
---|
[728ea56] | 5 | Let's create the directory tree on the LFS partition based on the FHS
|
---|
[d251197] | 6 | standard, which can be found at <ulink
|
---|
[6370fa6] | 7 | url="http://www.pathname.com/fhs/">http://www.pathname.com/fhs/</ulink>.
|
---|
[728ea56] | 8 | Issuing the following commands will create a default directory layout:
|
---|
[6370fa6] | 9 | </para>
|
---|
| 10 |
|
---|
| 11 | <blockquote><literallayout>
|
---|
| 12 |
|
---|
| 13 | <userinput>cd $LFS</userinput>
|
---|
[d1e1e60] | 14 | <userinput>mkdir -p bin boot dev/pts etc home lib mnt proc root sbin
|
---|
| 15 | tmp var</userinput>
|
---|
[6370fa6] | 16 | <userinput>for dirname in $LFS/usr $LFS/usr/local</userinput>
|
---|
| 17 | <userinput><literal> do</literal></userinput>
|
---|
| 18 | <userinput> mkdir $dirname</userinput>
|
---|
| 19 | <userinput> cd $dirname</userinput>
|
---|
| 20 | <userinput> mkdir bin etc include lib sbin share
|
---|
| 21 | src tmp var</userinput>
|
---|
| 22 | <userinput> ln -s share/man man</userinput>
|
---|
| 23 | <userinput> ln -s share/doc doc</userinput>
|
---|
| 24 | <userinput> ln -s share/info info</userinput>
|
---|
| 25 | <userinput> cd $dirname/share</userinput>
|
---|
| 26 | <userinput> mkdir dict doc info locale man nls misc
|
---|
| 27 | terminfo zoneinfo</userinput>
|
---|
| 28 | <userinput> cd $dirname/share/man</userinput>
|
---|
| 29 | <userinput> mkdir man1 man2 man3 man4 man5 man6 man7
|
---|
| 30 | man8</userinput>
|
---|
| 31 | <userinput>done</userinput>
|
---|
| 32 | <userinput>cd $LFS/var</userinput>
|
---|
| 33 | <userinput>mkdir lock log mail run spool tmp</userinput>
|
---|
| 34 |
|
---|
| 35 | </literallayout></blockquote>
|
---|
| 36 |
|
---|
| 37 | <para>
|
---|
[d251197] | 38 | Normally, directories are created with permission mode 755, which isn't
|
---|
[728ea56] | 39 | desired for all directories. The first change is a mode 0750 for the
|
---|
| 40 | $LFS/root directory. This is to make sure that not just everybody can
|
---|
| 41 | enter the /root directory (the same a user would do with /home/username
|
---|
| 42 | directories). The second change is a mode 1777 for the tmp
|
---|
[4848808] | 43 | directories. This way, any user can write data to the /tmp directory but
|
---|
| 44 | cannot remove another user's files (the latter is caused by
|
---|
| 45 | the socalled "sticky bit" - bit 1 of the 1777 bit mask).
|
---|
[6370fa6] | 46 | </para>
|
---|
| 47 |
|
---|
| 48 | <blockquote><literallayout>
|
---|
| 49 |
|
---|
| 50 | <userinput>cd $LFS &&</userinput>
|
---|
| 51 | <userinput>chmod 0750 root &&</userinput>
|
---|
[846a394] | 52 | <userinput>chmod 1777 tmp usr/tmp usr/local/tmp var/tmp</userinput>
|
---|
[6370fa6] | 53 |
|
---|
| 54 | </literallayout></blockquote>
|
---|
| 55 |
|
---|
| 56 | <para>
|
---|
[ab8b352] | 57 | Now that the directories are created, copy the source files that were
|
---|
[728ea56] | 58 | downloaded in chapter 3 to some subdirectory under $LFS/usr/src (you
|
---|
| 59 | will need to create the desired directory yourself).
|
---|
[6370fa6] | 60 | </para>
|
---|
| 61 |
|
---|
| 62 | </sect1>
|
---|
| 63 |
|
---|