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