Applied a modified version of Alex's patch to split the in two.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@2283 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Timothy Bauscher 2003-01-05 16:19:00 +00:00
parent 2ae2d484bd
commit 5e40325fc2
7 changed files with 88 additions and 68 deletions

View File

@ -57,7 +57,12 @@
</itemizedlist>
</para></listitem>
<listitem><para>January 2nd, 2003 [geard]: Chapter 05 - All packages whose
<listitem><para>January 5th, 2003 [timothy]: Chapter 05 - Applied Alex's
patch to split the <emphasis>Install all software as an unprivileged
user</emphasis> page into two pages: <emphasis>Adding the user lfs</emphasis>
and <emphasis>Setting up the environment</emphasis>.</para></listitem>
<listitem><para>January 2nd, 2003 [gerard]: Chapter 05 - All packages whose
configure script supports the LDFLAGS environment variable now use it
rather than passing the variable down to
<userinput>make</userinput>.</para></listitem>
@ -77,7 +82,7 @@ mega-patch with three separate patches (man-1.5k-80cols.patch,
man-1.5k-manpath.patch and man-1.5k-pager.patch).</para></listitem>
<listitem><para>January 1st, 2003 [gerard]: Chapter 06 - Glibc Second Pass:
Fixec typo in linuxthreads man pages installation.</para></listitem>
Fixed typo in linuxthreads man pages installation.</para></listitem>
<listitem><para>January 1st, 2003 [gerard]: Chapter 06 - Linux Kernel: The
man pages can't be installed here because it requires Perl. Moved to end of

30
chapter05/adding-user.xml Normal file
View File

@ -0,0 +1,30 @@
<sect1 id="ch05-addinguser">
<title>Adding the user lfs</title>
<?dbhtml filename="addinguser.html" dir="chapter05"?>
<para>If you are logged in as <emphasis>root</emphasis> during Chapter 5,
your host system can be damaged by a single mistake. We recommend that
you build the packages in Chapter 5 as an unprivileged user. You could use
your own user name, but to ensure a clean build environment, we'll create a
new user: <emphasis>lfs</emphasis>. As <emphasis>root</emphasis>, issue
the following commands to add the new user:</para>
<para><screen><userinput>useradd -s /bin/bash -m lfs
passwd lfs</userinput></screen></para>
<para>In order to grant the user <emphasis>lfs</emphasis> the proper permissions
to the <filename>$LFS/static</filename> directory, issue the following
command:</para>
<para><screen><userinput>chown -R lfs $LFS/static</userinput></screen></para>
<para>Next, login as user <emphasis>lfs</emphasis>. This can be accomplished
via a virtual console, display manager or with the substitute user
command:</para>
<para><screen><userinput>su - lfs</userinput></screen></para>
<para>The "<userinput>-</userinput>" instructs <userinput>su</userinput> to
start a new, clean shell.</para>
</sect1>

View File

@ -5,7 +5,8 @@
&c5-introduction;
&c5-whystatic;
&c5-creatingstaticdir;
&c5-installasuser;
&c5-addinguser;
&c5-settingenviron;
&c5-bash;
&c5-binutils;
&c5-bzip2;

View File

@ -1,62 +0,0 @@
<sect1 id="ch05-installasuser">
<title>Install all software as an unprivileged user</title>
<?dbhtml filename="installasuser.html" dir="chapter05"?>
<para>When you are logged in as root during Chapter 5, it is possible
that some files of your host system will be overwritten by the ones
you'll build in Chapter 5. There can be all kinds of reasons for this
to happen, for example because the $LFS environment variable is not
set. Overwriting some files from your host system will most likely
cause all kinds of problems, so it's a good idea to be logged in as
an unprivileged user during Chapter 5. To make sure the environment
is as clean as possible, we'll create a new user "lfs" that can be
used while building the static installation. Issuing the following
commands as root will create a new user "lfs":</para>
<para><screen><userinput>useradd -s /bin/bash -m lfs &amp;&amp;
passwd lfs</userinput></screen></para>
<para>Now we need to give proper permissions to the <filename
class="directory">$LFS/static</filename> directory so user "lfs" can write
to it:</para>
<para><screen><userinput>chown -R lfs $LFS/static</userinput></screen></para>
<para>You have to login as user <emphasis>lfs</emphasis> now to continue
with the rest of this chapter. You can do this two ways: either the normal
way through the console or the display manager, or with
<userinput>su - lfs</userinput>. When you're working as user
<emphasis>lfs</emphasis>, type the following commands to set up a good
environment to work in:</para>
<para><screen><userinput>cat &gt; ~lfs/.bash_profile &lt;&lt; "EOF"
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
CC='gcc -s'
export LFS LC_ALL CC
EOF
source ~/.bash_profile</userinput></screen></para>
<para>This profile makes sure the umask is set to 022 so newly created
files and directories will have the correct permissions. It is advisable
to keep this setting throughout your LFS installation. Also, the $LFS,
$LC_ALL, and $CC environment variables are set. $LFS has been explained
in previous chapters already. $LC_ALL is a variable that is used for
internationalization.</para>
<para>When your host distribution uses a glibc version older than 2.2.4,
having $LC_ALL set to something other than "C" or "POSIX" while working
through Chapter 5 may cause trouble when you exit the chroot environment
of Chapter 6 and try to return to it. By setting this to "POSIX" ("C"
is an alias for "POSIX") we ensure that everything will work as expected
in the chroot environment.</para>
<para>$CC is a variable we set in order to prevent debugging symbols from
being compiled into our static packages. By omitting these symbols during
the linking stage of compilation, we save hard drive space and decrease
our build time.</para>
</sect1>

View File

@ -0,0 +1,45 @@
<sect1 id="ch05-settingenviron">
<title>Setting up the environment</title>
<?dbhtml filename="settingenviron.html" dir="chapter05"?>
<para>While logged in as user <emphasis>lfs</emphasis>, issue the
following commands to set up a good work environment:</para>
<para><screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
CC="gcc -s"
export LFS LC_ALL CC
EOF
source ~/.bash_profile</userinput></screen></para>
<para>This profile sets the umask to 022, so newly created files will and
directories will have the correct permissions. To be more specific, only
the file owner will have write permission to new files and directories.
Other users of the system will be have read permission, and executable
permission to directories. It is advisable to keep this setting throughout
your LFS installation.</para>
<para>The LFS, LC_ALL, and CC environment variables are also set. The LFS
variable has been explained in previous chapters. LC_ALL is a variable used
for internationalization.</para>
<para>The LC_ALL variable controls the localization of certain programs,
making their messages follow the conventions of a specified country. If your
host system uses a version of <emphasis>glibc</emphasis> older than 2.2.4,
having LC_ALL set to something other than "C" or "POSIX" during Chapter 5
may cause trouble if you exit the chroot environment and wish to return later.
By setting LC_ALL to "POSIX" ("C" is an alias for "POSIX") we ensure that
everything will work as expected in the chroot environment.</para>
<para>CC is a variable we set in order to prevent debugging symbols from
being compiled into our static packages. By omitting these symbols during
the linking stage of compilation, we save hard drive space and decrease our
build time.</para>
<para>We are now prepared to begin building the temporary tools which will
support us in later chapters.</para>
</sect1>

View File

@ -2,4 +2,5 @@
<!ENTITY c5-introduction SYSTEM "../chapter05/introduction.xml">
<!ENTITY c5-whystatic SYSTEM "../chapter05/whystatic.xml">
<!ENTITY c5-creatingstaticdir SYSTEM "../chapter05/creatingstaticdir.xml">
<!ENTITY c5-installasuser SYSTEM "../chapter05/installasuser.xml">
<!ENTITY c5-addinguser SYSTEM "../chapter05/adding-user.xml">
<!ENTITY c5-settingenviron SYSTEM "../chapter05/setting-environment.xml">

View File

@ -4,8 +4,8 @@
<!ENTITY book SYSTEM "book/book.xml">
<!ENTITY version "20030103">
<!ENTITY releasedate "January 3rd, 2003">
<!ENTITY version "20030105">
<!ENTITY releasedate "January 5th, 2003">
<!ENTITY ftp-root "ftp://ftp.linuxfromscratch.org">
<!ENTITY http-root "http://ftp.linuxfromscratch.org">