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