creatingdirs.xml 2.6 KB

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