[6370fa6] | 1 | <sect1 id="ch02-aboutlfs">
|
---|
| 2 | <title>About $LFS</title>
|
---|
| 3 |
|
---|
[b822811] | 4 | <para>Please read the following carefully: throughout this book
|
---|
[97f1db3] | 5 | the variable $LFS will be used frequently. $LFS must at all times be
|
---|
[6370fa6] | 6 | replaced by the directory where the partition that contains the LFS system
|
---|
| 7 | is mounted. How to create and where to mount the partition will be
|
---|
[ff9fe017] | 8 | explained in full detail in chapter 4. In my case, the LFS
|
---|
[b822811] | 9 | partition is mounted on /mnt/lfs.</para>
|
---|
[97f1db3] | 10 |
|
---|
[b822811] | 11 | <para>For example when you are told to run a command like
|
---|
[ff9fe017] | 12 | <userinput>./configure --prefix=$LFS</userinput> you actually have to
|
---|
[b822811] | 13 | execute <userinput>./configure --prefix=/mnt/lfs</userinput></para>
|
---|
[6370fa6] | 14 |
|
---|
[b822811] | 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>
|
---|
[6370fa6] | 17 |
|
---|
[b822811] | 18 | <para>A possible solution is to set the environment variable LFS.
|
---|
[97f1db3] | 19 | This way $LFS can be entered literally instead of replacing it by
|
---|
| 20 | /mnt/lfs. This is accomplished by running <userinput>export
|
---|
[b822811] | 21 | LFS=/mnt/lfs</userinput>.</para>
|
---|
[6370fa6] | 22 |
|
---|
[b822811] | 23 | <para>Now, if you are told to run a command like <userinput>./configure
|
---|
[97f1db3] | 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
|
---|
[b822811] | 26 | when you hit enter after having typed the command).</para>
|
---|
[6370fa6] | 27 |
|
---|
[b822811] | 28 | <para>If you plan to use $LFS, do not forget to set the $LFS variable at all
|
---|
[280bcc8] | 29 | times. If the variable is not set and is used in a command, $LFS will
|
---|
[97f1db3] | 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
|
---|
[b822811] | 34 | destroy your current password database file.</para>
|
---|
[6370fa6] | 35 |
|
---|
[b822811] | 36 | <para>One way to make sure that $LFS is set at all times is adding it to
|
---|
[97f1db3] | 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
|
---|
[b822811] | 39 | set.</para>
|
---|
[6370fa6] | 40 |
|
---|
| 41 | </sect1>
|
---|
| 42 |
|
---|