aboutlfs.xml 1.9 KB

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