| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 | <sect1 id="ch05-creatingdirs"><title>Creating directories</title><?dbhtml filename="creatingdirs.html" dir="chapter05"?><para>Let's now create the directory tree on the LFS partition based onthe FHS standard, which can be found at<ulink url="http://www.pathname.com/fhs/"/>.Issuing the following commands will create a default directory layout:</para> <para><screen><userinput>cd $LFS &&mkdir -p bin boot dev/pts etc/opt home lib mnt proc root sbin tmp var opt &&for dirname in $LFS/usr $LFS/usr/local    do    mkdir $dirname    cd $dirname    mkdir bin etc include lib sbin share src    ln -s share/man    ln -s share/doc    ln -s share/info    cd $dirname/share    mkdir dict doc info locale man nls misc terminfo zoneinfo    cd $dirname/share/man    mkdir man{1,2,3,4,5,6,7,8}done &&cd $LFS/var &&mkdir -p lock log mail run spool tmp opt cache lib/misc local &&cd $LFS/opt &&mkdir bin doc include info lib man &&cd $LFS/usr &&ln -s ../var/tmp</userinput></screen></para><para>Normally, directories are created with permission mode 755, which isn'tdesired 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><para><screen><userinput>cd $LFS &&chmod 0750 root &&chmod 1777 tmp var/tmp</userinput></screen></para><para>Now that the directories are created, copy the source files that weredownloaded in chapter 3 to some subdirectory under $LFS/usr/src (youwill 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 thebin, games, include, lib, man, sbin, and share subdirectories. You canalter your /usr/local directory yourself if you want your system to beFHS-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 were needed.</para></sect2></sect1>
 |