aboutlfs.xml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-partitioning-aboutlfs">
  8. <?dbhtml filename="aboutlfs.html"?>
  9. <title>Setting The $LFS Variable</title>
  10. <para>Throughout this book, the environment variable <envar>LFS</envar> will
  11. be used several times. You should ensure that this variable is always defined
  12. throughout the LFS build process. It should be set to the name of the
  13. directory where you will be building your LFS system - we will use
  14. <filename class="directory">/mnt/lfs</filename> as an example, but the
  15. directory choice is up to you. If you are building LFS on a separate
  16. partition, this directory will be the mount point for the partition.
  17. Choose a directory location and set the variable with the
  18. following command:</para>
  19. <screen role="nodump"><userinput>export LFS=<replaceable>/mnt/lfs</replaceable></userinput></screen>
  20. <para>Having this variable set is beneficial in that commands such as
  21. <command>mkdir -v $LFS/tools</command> can be typed literally. The shell
  22. will automatically replace <quote>$LFS</quote> with
  23. <quote>/mnt/lfs</quote> (or whatever the variable was set to) when it
  24. processes the command line.</para>
  25. <caution>
  26. <para>Do not forget to check that <envar>LFS</envar> is set whenever
  27. you leave and reenter the current working environment (such as when doing a
  28. <command>su</command> to <systemitem class="username">root</systemitem> or
  29. another user). Check that the <envar>LFS</envar> variable is set up
  30. properly with:</para>
  31. <screen role="nodump"><userinput>echo $LFS</userinput></screen>
  32. <para>Make sure the output shows the path to your LFS system's build
  33. location, which is <filename class="directory">/mnt/lfs</filename> if the
  34. provided example was followed. If the output is incorrect, use the command
  35. given earlier on this page to set <envar>$LFS</envar> to the correct
  36. directory name.</para>
  37. </caution>
  38. <note><para>One way to ensure that the <envar>LFS</envar> variable is always
  39. set is to edit the <filename>.bash_profile</filename> file in both your
  40. personal home directory and in <filename>/root/.bash_profile</filename> and
  41. enter the export command above. In addition, the shell specified in the
  42. <filename>/etc/passwd</filename> file for all users that need the
  43. <envar>LFS</envar> variable needs to be bash to ensure that the
  44. <filename>/root/.bash_profile</filename> file is incorporated as a part of
  45. the login process.</para>
  46. <para>Another consideration is the method that is used to log into the
  47. host system. If logging in through a graphical display manager, the
  48. user's <filename>.bash_profile</filename> is not normally used when
  49. a virtual terminal is started. In this case, add the export command to
  50. the <filename>.bashrc</filename> file for the user and root. In addition,
  51. some distributions have instructions to not run the <filename>.bashrc</filename>
  52. instructions in a non-interactive bash invocation. Be sure to add the
  53. export command before the test for non-interactive use.</para>
  54. </note>
  55. </sect1>