aboutlfs.xml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <sect1 id="ch02-aboutlfs">
  2. <title>About $LFS</title>
  3. <?dbhtml filename="aboutlfs.html" dir="chapter02"?>
  4. <para>Please read the following carefully: throughout this book
  5. the variable $LFS will be used frequently. $LFS must at all times be
  6. replaced with the directory where the partition that contains the LFS system
  7. is mounted. How to create and where to mount the partition will be
  8. explained in full detail in chapter 4. For example, let's assume that
  9. the LFS partition is mounted on /mnt/lfs.</para>
  10. <para>For example when you are told to run a command like
  11. <userinput>./configure --prefix=$LFS</userinput> you actually have to
  12. execute <userinput>./configure --prefix=/mnt/lfs</userinput></para>
  13. <para>It's important that this is done no matter where it is read; be it in
  14. commands entered in a shell, or in a file edited or created.</para>
  15. <para>A possible solution is to set the environment variable LFS.
  16. This way $LFS can be entered literally instead of replacing it with
  17. /mnt/lfs. This is accomplished by running: </para>
  18. <para><screen><userinput>export LFS=/mnt/lfs</userinput></screen></para>
  19. <para>Now, if you are told to run a command like <userinput>./configure
  20. --prefix=$LFS</userinput> you can type that literally. Your shell will
  21. replace $LFS with /mnt/lfs when it processes the command line (meaning
  22. when you hit enter after having typed the command).</para>
  23. <para>If you plan to use $LFS, do not forget to set the $LFS variable at all
  24. times. If the variable is not set and is used in a command, $LFS will
  25. be ignored and whatever is left will be executed. A command like
  26. <userinput>echo "root:x:0:0:root:/root:/bin/bash" &gt;
  27. $LFS/etc/passwd</userinput> without the $LFS variable set will
  28. re-create your host system's /etc/passwd file. Simply put: it will
  29. destroy your current password database file.</para>
  30. <para>One way to make sure that $LFS is set at all times is adding it to
  31. the /root/.bash_profile and /root/.bashrc files so that every time
  32. you login as user root, or you 'su' to user root, the $LFS variable is
  33. set.</para>
  34. </sect1>