mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-01-19 21:49:13 +00:00
a8e5938ec5
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@536 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
83 lines
3.2 KiB
XML
83 lines
3.2 KiB
XML
<sect1 id="ch04-creatingdirs">
|
|
<title>Creating directories</title>
|
|
|
|
<para>
|
|
Let's create the directory tree on the LFS partition based on the FHS
|
|
standard, which can be found at <ulink
|
|
url="http://www.pathname.com/fhs/">http://www.pathname.com/fhs/</ulink>.
|
|
Issuing the following commands will create a default directory layout:
|
|
</para>
|
|
|
|
<blockquote><literallayout>
|
|
<userinput>cd $LFS</userinput>
|
|
<userinput>mkdir -p bin boot dev/pts etc/opt home lib mnt proc
|
|
root sbin tmp var opt</userinput>
|
|
<userinput>for dirname in $LFS/usr $LFS/usr/local</userinput>
|
|
<userinput><literal> do</literal></userinput>
|
|
<userinput> mkdir $dirname</userinput>
|
|
<userinput> cd $dirname</userinput>
|
|
<userinput> mkdir bin etc include lib sbin share
|
|
src var</userinput>
|
|
<userinput> ln -s share/man man</userinput>
|
|
<userinput> ln -s share/doc doc</userinput>
|
|
<userinput> ln -s share/info info</userinput>
|
|
<userinput> cd $dirname/share</userinput>
|
|
<userinput> mkdir dict doc info locale man nls misc
|
|
terminfo zoneinfo</userinput>
|
|
<userinput> cd $dirname/share/man</userinput>
|
|
<userinput> mkdir man1 man2 man3 man4 man5 man6 man7
|
|
man8</userinput>
|
|
<userinput>done</userinput>
|
|
<userinput>cd $LFS/var</userinput>
|
|
<userinput>mkdir -p lock log mail run spool tmp opt cache lib/misc
|
|
local</userinput>
|
|
<userinput>cd $LFS/opt</userinput>
|
|
<userinput>mkdir bin doc include info lib man</userinput>
|
|
<userinput>ln -s /var/tmp /usr/tmp</userinput>
|
|
</literallayout></blockquote>
|
|
|
|
<para>
|
|
Normally, directories are created with permission mode 755, which isn't
|
|
desired for all directories. The first change is a mode 0750 for the
|
|
$LFS/root directory. This is to make sure that not just everybody can
|
|
enter the /root directory (the same a user would do with /home/username
|
|
directories). The second change is a mode 1777 for the tmp
|
|
directories. This way, any user can write data to the /tmp or /var/tmp
|
|
directory but cannot remove another user's files (the latter is caused
|
|
by the so-called "sticky bit" - bit 1 of the 1777 bit mask).
|
|
</para>
|
|
|
|
<blockquote><literallayout>
|
|
<userinput>cd $LFS &&</userinput>
|
|
<userinput>chmod 0750 root &&</userinput>
|
|
<userinput>chmod 1777 tmp var/tmp</userinput>
|
|
</literallayout></blockquote>
|
|
|
|
<para>
|
|
Now that the directories are created, copy the source files that were
|
|
downloaded in chapter 3 to some subdirectory under $LFS/usr/src (you
|
|
will need to create the desired directory yourself).
|
|
</para>
|
|
|
|
<sect2>
|
|
<title>FHS compliance notes</title>
|
|
|
|
<para>
|
|
The FHS stipulates that the /usr/local directory should contain the bin, games,
|
|
include, lib, man, sbin, and share subdirectories. You can alter your /usr/local
|
|
directory yourself if you want your system to be FHS-compliant.
|
|
</para>
|
|
|
|
<para>
|
|
Also, the standard says that there should exist a /usr/share/games directory,
|
|
which we don't much like for a base system. But feel free to make your system
|
|
FHS-compliant if you wish. The FHS isn't precise as to the structure of the
|
|
/usr/local/share subdirectories, so we took the liberty of creating the
|
|
directories that we felt needed.
|
|
</para>
|
|
|
|
</sect2>
|
|
|
|
</sect1>
|
|
|