1 | <sect1 id="ch02-aboutlfs">
|
---|
2 | <title>About $LFS</title>
|
---|
3 | <?dbhtml filename="aboutlfs.html" dir="chapter02"?>
|
---|
4 |
|
---|
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>
|
---|
11 |
|
---|
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>
|
---|
15 |
|
---|
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>
|
---|
18 |
|
---|
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 <userinput>export
|
---|
22 | LFS=/mnt/lfs</userinput>.</para>
|
---|
23 |
|
---|
24 | <para>Now, if you are told to run a command like <userinput>./configure
|
---|
25 | --prefix=$LFS</userinput> you can type that literally. Your shell will
|
---|
26 | replace $LFS with /mnt/lfs when it processes the command line (meaning
|
---|
27 | when you hit enter after having typed the command).</para>
|
---|
28 |
|
---|
29 | <para>If you plan to use $LFS, do not forget to set the $LFS variable at all
|
---|
30 | times. If the variable is not set and is used in a command, $LFS will
|
---|
31 | be ignored and whatever is left will be executed. A command like
|
---|
32 | <userinput>echo "root:x:0:0:root:/root:/bin/bash" >
|
---|
33 | $LFS/etc/passwd</userinput> without the $LFS variable set will
|
---|
34 | re-create your host system's /etc/passwd file. Simply put: it will
|
---|
35 | destroy your current password database file.</para>
|
---|
36 |
|
---|
37 | <para>One way to make sure that $LFS is set at all times is adding it to
|
---|
38 | the /root/.bash_profile and /root/.bashrc files so that every time
|
---|
39 | you login as user root, or you 'su' to user root, the $LFS variable is
|
---|
40 | set.</para>
|
---|
41 |
|
---|
42 | </sect1>
|
---|
43 |
|
---|