Changeset 155d6d1 for chapter04/settingenviron.xml
- Timestamp:
- 01/30/2005 10:36:17 AM (19 years ago)
- Branches:
- 10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 6.1, 6.1.1, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
- Children:
- 8bbebcc
- Parents:
- 4642c89
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter04/settingenviron.xml
r4642c89 r155d6d1 8 8 <?dbhtml filename="settingenvironment.html"?> 9 9 10 <!--11 <para>We're going to set up a good working environment by creating two new12 startup files for the <command>bash</command> shell. While logged in as13 user <emphasis>lfs</emphasis>, issue the following command to create a new14 <filename>.bash_profile</filename>:</para>15 -->16 17 10 <screen><userinput>cat > ~/.bash_profile << "EOF" 18 11 exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash 19 12 EOF</userinput></screen> 20 21 <!--22 <para>Normally, when you log on as user <emphasis>lfs</emphasis>,23 the initial shell is a <emphasis>login</emphasis> shell which reads the24 <filename>/etc/profile</filename> of your host (probably containing some25 settings of environment variables) and then <filename>.bash_profile</filename>.26 The <command>exec env -i ... /bin/bash</command> command in the latter file27 replaces the running shell with a new one with a completely empty environment,28 except for the HOME, TERM and PS1 variables. This ensures that no unwanted and29 potentially hazardous environment variables from the host system leak into our30 build environment. The technique used here is a little strange, but it achieves31 the goal of enforcing a clean environment.</para>32 33 <para>The new instance of the shell is a <emphasis>non-login</emphasis> shell,34 which doesn't read the <filename>/etc/profile</filename> or35 <filename>.bash_profile</filename> files, but reads the36 <filename>.bashrc</filename> file instead. Create this latter file now:</para>37 -->38 13 39 14 <screen><userinput>cat > ~/.bashrc << "EOF" … … 46 21 EOF</userinput></screen> 47 22 48 <!--49 <para>The <command>set +h</command> command turns off50 <command>bash</command>'s hash function. Normally hashing is a useful51 feature: <command>bash</command> uses a hash table to remember the52 full pathnames of executable files to avoid searching the PATH time and time53 again to find the same executable. However, we'd like the new tools to be54 used as soon as they are installed. By switching off the hash function, our55 <quote>interactive</quote> commands (<command>make</command>,56 <command>patch</command>, <command>sed</command>,57 <command>cp</command> and so forth) will always use58 the newest available version during the build process.</para>59 60 <para>Setting the user file-creation mask to 022 ensures that newly created61 files and directories are only writable for their owner, but readable and62 executable for anyone.</para>63 64 <para>The LFS variable should of course be set to the mount point you65 chose.</para>66 67 <para>The LC_ALL variable controls the localization of certain programs,68 making their messages follow the conventions of a specified country. If your69 host system uses a version of Glibc older than 2.2.4,70 having LC_ALL set to something other than <quote>POSIX</quote> or71 <quote>C</quote> during this chapter may cause trouble if you exit the chroot72 environment and wish to return later. By setting LC_ALL to <quote>POSIX</quote>73 (or <quote>C</quote>, the two are equivalent) we ensure that74 everything will work as expected in the chroot environment.</para>75 76 <para>We prepend <filename class="directory">/tools/bin</filename> to the standard PATH so77 that, as we move along through this chapter, the tools we build will get used78 during the rest of the building process.</para>79 80 <para>Finally, to have our environment fully prepared for building the81 temporary tools, source the just-created profile:</para>82 -->83 84 23 <screen><userinput>source ~/.bash_profile</userinput></screen> 85 24
Note:
See TracChangeset
for help on using the changeset viewer.