1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="ch-partitioning-aboutlfs">
|
---|
9 | <?dbhtml filename="aboutlfs.html"?>
|
---|
10 |
|
---|
11 | <title>Setting The $LFS Variable</title>
|
---|
12 |
|
---|
13 | <para>Throughout this book, the environment variable <envar>LFS</envar> will
|
---|
14 | be used several times. You should ensure that this variable is always defined
|
---|
15 | throughout the LFS build process. It should be set to the name of the
|
---|
16 | directory where you will be building your LFS system - we will use
|
---|
17 | <filename class="directory">/mnt/lfs</filename> as an example, but you may
|
---|
18 | choose any directory name you want. If you are building LFS on a separate
|
---|
19 | partition, this directory will be the mount point for the partition.
|
---|
20 | Choose a directory location and set the variable with the
|
---|
21 | following command:</para>
|
---|
22 |
|
---|
23 | <screen role="nodump"><userinput>export LFS=<replaceable>/mnt/lfs</replaceable></userinput></screen>
|
---|
24 |
|
---|
25 | <para>Having this variable set is beneficial in that commands such as
|
---|
26 | <command>mkdir -v $LFS/tools</command> can be typed literally. The shell
|
---|
27 | will automatically replace <quote>$LFS</quote> with
|
---|
28 | <quote>/mnt/lfs</quote> (or whatever value the variable was set to) when it
|
---|
29 | processes the command line.</para>
|
---|
30 |
|
---|
31 | <caution>
|
---|
32 | <para>Do not forget to check that <envar>LFS</envar> is set whenever
|
---|
33 | you leave and reenter the current working environment (such as when doing a
|
---|
34 | <command>su</command> to <systemitem class="username">root</systemitem> or
|
---|
35 | another user). Check that the <envar>LFS</envar> variable is set up
|
---|
36 | properly with:</para>
|
---|
37 |
|
---|
38 | <screen role="nodump"><userinput>echo $LFS</userinput></screen>
|
---|
39 |
|
---|
40 | <para>Make sure the output shows the path to your LFS system's build
|
---|
41 | location, which is <filename class="directory">/mnt/lfs</filename> if the
|
---|
42 | provided example was followed. If the output is incorrect, use the command
|
---|
43 | given earlier on this page to set <envar>$LFS</envar> to the correct
|
---|
44 | directory name.</para>
|
---|
45 | </caution>
|
---|
46 |
|
---|
47 | <note><para>One way to ensure that the <envar>LFS</envar> variable is always
|
---|
48 | set is to edit the <filename>.bash_profile</filename> file in both your
|
---|
49 | personal home directory and in <filename>/root/.bash_profile</filename> and
|
---|
50 | enter the export command above. In addition, the shell specified in the
|
---|
51 | <filename>/etc/passwd</filename> file for all users that need the
|
---|
52 | <envar>LFS</envar> variable must be bash to ensure that the
|
---|
53 | <filename>/root/.bash_profile</filename> file is incorporated as a part of
|
---|
54 | the login process.</para>
|
---|
55 |
|
---|
56 | <para>Another consideration is the method that is used to log into the
|
---|
57 | host system. If logging in through a graphical display manager, the
|
---|
58 | user's <filename>.bash_profile</filename> is not normally used when
|
---|
59 | a virtual terminal is started. In this case, add the export command to
|
---|
60 | the <filename>.bashrc</filename> file for the user and
|
---|
61 | <systemitem class="username">root</systemitem>. In addition,
|
---|
62 | some distributions use an "if" test, and do not run the remaining <filename>.bashrc</filename>
|
---|
63 | instructions for a non-interactive bash invocation. Be sure to place the
|
---|
64 | export command ahead of the test for non-interactive use.</para>
|
---|
65 |
|
---|
66 | </note>
|
---|
67 |
|
---|
68 | </sect1>
|
---|