aboutlfs.xml 1.9 KB

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