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