Ignore:
Timestamp:
Feb 8, 2009, 8:31:04 PM (16 years ago)
Author:
Chris Staub <chris@…>
Branches:
clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
Children:
efbfaf5
Parents:
4632d6a
Message:

Reorder bootscripts section and split Bash Shell Startup Files page

Location:
BOOK/bootscripts/common
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • BOOK/bootscripts/common/profile.xml

    r4632d6a r73e1db21  
    1818  files to help create an environment to run in. Each file has a
    1919  specific use and may affect login and interactive environments
    20   differently. The files in the <filename
    21   class="directory">/etc</filename> directory provide global settings.
    22   If an equivalent file exists in the home directory, it may override
    23   the global settings.</para>
     20  differently. The files in the <filename class="directory">/etc</filename>
     21  directory provide global settings. If an equivalent file exists in the
     22  home directory, it may override the global settings.</para>
    2423
    2524  <para>An interactive login shell is started after a successful login,
     
    3332
    3433  <para>For more information, see <command>info bash</command> under the
    35   <emphasis>Bash Startup Files and Interactive Shells</emphasis> section.</para>
     34  <emphasis>Bash Startup Files and Interactive Shells</emphasis> section,
     35  and <ulink url="&cblfs-root;index.php/Bash_Startup_Files">Bash Startup
     36  Files</ulink> in CBLFS.</para>
    3637
    3738  <para>The files <filename>/etc/profile</filename> and
    3839  <filename>~/.bash_profile</filename> are read when the shell is
    39   invoked as an interactive login shell.</para>
    40 
    41   <para>The base <filename>/etc/profile</filename> below sets some
    42   environment variables necessary for native language support. Setting
    43   them properly results in:</para>
    44 
    45   <itemizedlist>
    46     <listitem>
    47       <para>The output of programs translated into the native language</para>
    48     </listitem>
    49     <listitem>
    50       <para>Correct classification of characters into letters, digits and
    51       other classes. This is necessary for <command>bash</command> to
    52       properly accept non-ASCII characters in command lines in non-English
    53       locales</para>
    54     </listitem>
    55     <listitem>
    56       <para>The correct alphabetical sorting order for the country</para>
    57     </listitem>
    58     <listitem>
    59       <para>Appropriate default paper size</para>
    60     </listitem>
    61     <listitem>
    62       <para>Correct formatting of monetary, time, and date values</para>
    63     </listitem>
    64   </itemizedlist>
    65 
    66   <para>This script also sets the <envar>INPUTRC</envar> environment variable
    67   that makes Bash and Readline use the <filename>/etc/inputrc</filename> file
    68   created earlier.</para>
    69 
    70   <para>Replace <replaceable>[ll]</replaceable> below with the
    71   two-letter code for the desired language (e.g., <quote>en</quote>) and
    72   <replaceable>[CC]</replaceable> with the two-letter code for the
    73   appropriate country (e.g., <quote>GB</quote>).
    74   <replaceable>[charmap]</replaceable> should be replaced with the
    75   canonical charmap for your chosen locale.</para>
    76 
    77   <para>The list of all locales supported by Glibc can be obtained by running
    78   the following command:</para>
    79 
    80 <screen role="nodump"><userinput>locale -a</userinput></screen>
    81 
    82   <para>Locales can have a number of synonyms, e.g. <quote>ISO-8859-1</quote>
    83   is also referred to as <quote>iso8859-1</quote> and <quote>iso88591</quote>.
    84   Some applications cannot handle the various synonyms correctly, so it is
    85   safest to choose the canonical name for a particular locale. To determine
    86   the canonical name, run the following command, where <replaceable>[locale
    87   name]</replaceable> is the output given by <command>locale -a</command> for
    88   your preferred locale (<quote>en_US.utf8</quote> in our example).</para>
    89 
    90 <screen role="nodump"><userinput>LC_ALL=<replaceable>[locale name]</replaceable> locale charmap</userinput></screen>
    91 
    92   <para>For the <quote>en_US.utf8</quote> locale, the above command
    93   will print:</para>
    94 
    95 <screen><computeroutput>UTF-8</computeroutput></screen>
    96 
    97   <para>This results in a final locale setting of <quote>en_US.UTF-8</quote>.
    98   It is important that the locale found using the heuristic above is tested prior
    99   to it being added to the Bash startup files:</para>
    100 
    101 <screen role="nodump"><userinput>LC_ALL=[locale name] locale country
    102 LC_ALL=[locale name] locale language
    103 LC_ALL=[locale name] locale charmap
    104 LC_ALL=[locale name] locale int_curr_symbol
    105 LC_ALL=[locale name] locale int_prefix</userinput></screen>
    106 
    107   <para>The above commands should print the language name, the character
    108   encoding used by the locale, the local currency, and the prefix to dial
    109   before the telephone number in order to get into the country. If any of the
    110   commands above fail with a message similar to the one shown below, this means
    111   that your locale was either not installed in Chapter 10 or is not supported by
    112   the default installation of Glibc.</para>
    113 
    114 <screen><computeroutput>locale: Cannot set LC_* to default locale: No such file or directory</computeroutput></screen>
    115 
    116   <para>If this happens, you should either install the desired locale using
    117   the <command>localedef</command> command, or consider choosing a different
    118   locale. Further instructions assume that there are no such error messages
    119   from Glibc.</para>
    120 
    121   <para>Some packages beyond CLFS may also lack support for your chosen locale.
    122   One example is the X library (part of the X Window System), which outputs
    123   the following error message:</para>
    124 
    125 <screen><computeroutput>Warning: locale not supported by Xlib, locale set to C</computeroutput></screen>
    126 
    127   <para>Sometimes it is possible to fix this by removing the charmap part of
    128   the locale specification, as long as that does not change the character map
    129   that Glibc associates with the locale (this can be checked by running the
    130   <command>locale charmap</command> command in both locales). For example,
    131   one would have to change &quot;de_DE.ISO-8859-15@euro&quot; to
    132   &quot;de_DE@euro&quot; in order to get this locale recognized by Xlib.</para>
    133 
    134   <para>Other packages can also function incorrectly (but may not necessarily
    135   display any error messages) if the locale name does not meet their expectations.
    136   In those cases, investigating how other Linux distributions support your locale
    137   might provide some useful information.</para>
    138 
    139   <para>Once the proper locale settings have been determined, create the
    140   <filename>/etc/profile</filename> file:</para>
    141 
    142 <screen><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
    143 <literal># Begin /etc/profile
    144 
    145 export LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>.<replaceable>[charmap]</replaceable>
    146 export INPUTRC=/etc/inputrc
    147 
    148 # End /etc/profile</literal>
    149 EOF</userinput></screen>
    150 
    151   <para>Setting the keyboard layout, screen font, and locale-related
    152   environment variables are the only internationalization steps needed to
    153   support locales that use ordinary single-byte encodings and left-to-right
    154   writing direction. UTF-8 has been testing on the English, French, German,
    155   Italian, and Spanish locales. All other locales are untested. If you discover
    156   issues with any other locale please open a ticket in our trac system.</para>
    157 
    158   <para>Some locales need addtional programs and support. CLFS will not be supporting
    159   these locales via the book. We welcome the support for these other locales via the
    160   <ulink url="&cblfs-root;"/>.</para>
     40  invoked as an interactive login shell. In the next section, a base
     41  <filename>/etc/profile</filename> will be created to set up locale
     42  information.</para>
    16143
    16244</sect1>
Note: See TracChangeset for help on using the changeset viewer.