diff options
author | Zack Winkles <winkie@linuxfromscratch.org> | 2004-05-06 16:22:04 +0000 |
---|---|---|
committer | Zack Winkles <winkie@linuxfromscratch.org> | 2004-05-06 16:22:04 +0000 |
commit | b32e80330973383d4eca995d6193e35a743176cd (patch) | |
tree | c657760bd2b5c756d0371c908425ecc5835e90ca | |
parent | 4dc8dc63eef4a0b4e70ffa3ff12d8678a6a81e92 (diff) |
Committed Alexander's i18n patch
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3489 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
-rw-r--r-- | chapter06/glibc.xml | 19 | ||||
-rw-r--r-- | chapter06/kbd.xml | 42 | ||||
-rw-r--r-- | chapter06/man.xml | 29 | ||||
-rw-r--r-- | chapter06/sysvinit.xml | 22 | ||||
-rw-r--r-- | chapter07/bootscripts.xml | 16 | ||||
-rw-r--r-- | chapter07/chapter07.xml | 2 | ||||
-rw-r--r-- | chapter07/console.xml | 90 | ||||
-rw-r--r-- | chapter07/inputrc.xml | 94 | ||||
-rw-r--r-- | chapter07/profile.xml | 78 |
9 files changed, 333 insertions, 59 deletions
diff --git a/chapter06/glibc.xml b/chapter06/glibc.xml index 9296458e5..6fd2b5fb8 100644 --- a/chapter06/glibc.xml +++ b/chapter06/glibc.xml @@ -111,6 +111,25 @@ localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro localedef -i it_IT -f ISO-8859-1 it_IT localedef -i ja_JP -f EUC-JP ja_JP</userinput></screen> +<para>In fact, some locales installed by the +<command>make localedata/install-locales</command> +command above are not properly +supported by some applications that are in LFS and BLFS books. Because +of various problems that arise +due to application programmers making +assumptions that break in such locales, LFS <emphasis>should not</emphasis> +be used in locales that utilize +multibyte character sets (including UTF-8) or +right-to-left writing order. +Numerous unofficial and unstable patches are required to fix these problems, +and it has been decided not to support such complex locales. +This applies to the ja_JP and fa_IR locales as well: +they have been installed only +for gcc and gettext tests to pass, and e.g. <application>vim</application> +compiled according to this book doesn't work properly in them. +Various attempts to circumvent these +restrictions are documented in internationalization-related hints.</para> + <para>Finally, build the linuxthreads man pages, which are a great reference on the threading API (applicable to NPTL as well):</para> diff --git a/chapter06/kbd.xml b/chapter06/kbd.xml index 0f644bfb5..edc0abb1a 100644 --- a/chapter06/kbd.xml +++ b/chapter06/kbd.xml @@ -36,41 +36,8 @@ Diffutils, Flex, GCC, Gettext, Glibc, Grep, Gzip, M4, Make, Sed.</para> </sect2> -<sect2 id="conf-kbd"><title>Configuring your keyboard</title> -<indexterm zone="conf-kbd"> -<primary sortas="a-Kbd">Kbd</primary> -<secondary>configuring</secondary></indexterm> - -<para>Few things are more annoying than using Linux while a wrong keymap -for your keyboard is loaded. If you have a standard US keyboard, however, you -can skip this section, as the US keymap is the default as long as you don't -change it.</para> - -<para>To change the default keymap, create the -<filename class="symlink">/usr/share/kbd/keymaps/defkeymap.map.gz</filename> -symlink by running the following command:</para> - -<screen><userinput>ln -s path/to/keymap /usr/share/kbd/keymaps/defkeymap.map.gz</userinput></screen> - -<para>Of course, replace <filename>path/to/keymap</filename> with the path and -name of your keyboard's map file. For example, if you have a Dutch keyboard, -you would use <filename>/usr/share/kbd/keymaps/i386/qwerty/nl.map.gz</filename>.</para> - -<para>Another way to set your keyboard's layout is to compile the keymap -into the kernel. This ensures that your keyboard will always work as expected, -even when you boot into maintenance mode (by passing `init=/bin/sh' to the -kernel), as then the bootscript that normally sets up your keymap isn't run.</para> - -<para>When in <xref linkend="chapter-bootable"/> you're ready to compile the -kernel, run the following command to patch the current default keymap into the -source (you will have to repeat this command whenever you unpack a new -kernel):</para> - -<screen><userinput>loadkeys -m /usr/share/kbd/keymaps/defkeymap.map.gz > \ - /usr/src/linux-&linux-version;/drivers/char/defkeymap.c</userinput></screen> - -</sect2> - +<!-- The "Configuring your keyboard" section has been moved to +Chapter 7 and renamed to "Configuring Linux console" --> <sect2 id="contents-kbd"><title>Contents of Kbd</title> @@ -163,11 +130,12 @@ ASCII codes of the keys pressed on the keyboard.</para> <indexterm zone="ch-system-kbd unicode_start"><primary sortas="b-unicode_start">unicode_start</primary></indexterm> <para id="unicode_start"><command>unicode_start</command> puts the keyboard and console in -unicode mode.</para> +UNICODE mode. Never use it on LFS, because applications are not +configured to support UNICODE.</para> <indexterm zone="ch-system-kbd unicode_stop"><primary sortas="b-unicode_stop">unicode_stop</primary></indexterm> <para id="unicode_stop"><command>unicode_stop</command> reverts keyboard and console from -unicode mode.</para> +UNICODE mode.</para> </sect2> diff --git a/chapter06/man.xml b/chapter06/man.xml index a1cf37193..58667a2ca 100644 --- a/chapter06/man.xml +++ b/chapter06/man.xml @@ -73,6 +73,35 @@ configuration file in the <filename>/etc</filename> directory.</para></listitem> <filename>man.conf</filename> file and add the <emphasis>-c</emphasis> switch to NROFF.</para></note> +<para>If your character set uses 8-bit characters, search for the line +beginning with "NROFF" in /etc/man.conf, and verify that it coincides +with the following:</para> + +<screen>NROFF /usr/bin/nroff -Tlatin1 -mandoc</screen> + +<para>Note that you should use "latin1" even if it is not the character set +of your locale. The reason is that, +according to the specification, <application>groff</application> has +no means of typesetting characters outside ISO-8859-1 +without some strange escape codes, and localized manual +pages are therefore really a hack. When formatting manual pages, +<application>groff</application> thinks that they are in the ISO-8859-1 +encoding and this <emphasis>-Tlatin1</emphasis> switch tells +<application>groff</application> to use the same encoding for output. +Since <application>groff</application> does no recoding of input characters, +the formatted result is really in the same encoding as input (although +<application>groff</application> doesn't know that it is not ISO-8859-1) +and therefore it is usable as the input for a pager.</para> + +<para>Of course, this hack does not solve the problem of non-working +<command>man2dvi</command> program for localized manual +pages in non-ISO-8859-1 locales. +Also, it does not work at all with multibyte character sets. +The first problem does not have a solution currently. The second +one is not of a concern because the LFS installation does not support +multibyte character sets properly anyway. You may want to look at +internationalization related hints, though.</para> + <para>You may want to also take a look at the BLFS page at <ulink url="&blfs-root;view/cvs/postlfs/compressdoc.html"/> which deals with formatting and compression issues for man pages.</para> diff --git a/chapter06/sysvinit.xml b/chapter06/sysvinit.xml index 48418db53..4494a269a 100644 --- a/chapter06/sysvinit.xml +++ b/chapter06/sysvinit.xml @@ -74,16 +74,26 @@ ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now su:S016:once:/sbin/sulogin -1:2345:respawn:/sbin/agetty tty1 9600 -2:2345:respawn:/sbin/agetty tty2 9600 -3:2345:respawn:/sbin/agetty tty3 9600 -4:2345:respawn:/sbin/agetty tty4 9600 -5:2345:respawn:/sbin/agetty tty5 9600 -6:2345:respawn:/sbin/agetty tty6 9600 +1:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600 +2:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600 +3:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600 +4:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600 +5:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600 +6:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600 # End /etc/inittab <userinput>EOF</userinput></screen> +<para> The -I '\033(K' switch tells agetty to send this escape sequence to +the terminal before doing anything else. This escape sequence switches the +console character set to a user-defined one, which can be modified by +running the <command>setfont</command> program. +Actually, the <command>console</command> initscript from the LFS-Bootscripts +package calls the <command>setfont</command> program during system +startup. Sending this escape sequence is necessary for +people who use non-ISO-8859-1 screen font, but does not hurt native English +speakers.</para> + </sect2> diff --git a/chapter07/bootscripts.xml b/chapter07/bootscripts.xml index 9ee79f203..3c04492e2 100644 --- a/chapter07/bootscripts.xml +++ b/chapter07/bootscripts.xml @@ -30,8 +30,10 @@ <sect2 id="contents-bootscripts"><title>Contents of LFS-bootscripts</title> -<para><emphasis>Installed scripts</emphasis>: checkfs, cleanfs, functions, -halt, ifdown, ifup, loadkeys, localnet, mountfs, mountkernfs, network, rc, +<para><emphasis>Installed scripts</emphasis>: checkfs, cleanfs, +console, +functions, halt, ifdown, ifup, +localnet, mountfs, mountkernfs, network, rc, reboot, sendsignals, setclock, static, swap, sysklogd and template</para> </sect2> @@ -51,6 +53,12 @@ preserved between reboots, such as those in <filename>/var/run/</filename> and and removes the possibly present <filename>/etc/nologin</filename>, <filename>/fastboot</filename> and <filename>/forcefsck</filename> files.</para> +<indexterm zone="ch-scripts-bootscripts console-bootscripts"><primary sortas="d-console">console</primary></indexterm> +<para id="console-bootscripts">The <command>console</command> script +loads the keymap table you +specified as proper for your keyboard layout. +It also sets the screen font.</para> + <indexterm zone="ch-scripts-bootscripts functions-bootscripts"><primary sortas="d-functions">functions</primary></indexterm> <para id="functions-bootscripts">The <command>functions</command> script contains functions shared among different scripts, such as error and status checking.</para> @@ -62,10 +70,6 @@ different scripts, such as error and status checking.</para> <para id="ifdown-bootscripts">The <command>ifdown</command> and <command>ifup</command> scripts assist the network script with network devices.</para> -<indexterm zone="ch-scripts-bootscripts loadkeys-bootscripts"><primary sortas="d-loadkeys">loadkeys</primary></indexterm> -<para id="loadkeys-bootscripts">The <command>loadkeys</command> script loads the keymap table you -specified as proper for your keyboard layout.</para> - <indexterm zone="ch-scripts-bootscripts localnet-bootscripts"><primary sortas="d-localnet">localnet</primary></indexterm> <para id="localnet-bootscripts">The <command>localnet</command> script sets up the system's hostname and local loopback device.</para> diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml index f6b5a9ba5..345551968 100644 --- a/chapter07/chapter07.xml +++ b/chapter07/chapter07.xml @@ -13,6 +13,8 @@ <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="usage.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="setclock.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="console.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="inputrc.xml"/> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="profile.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="sysklogd.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="hostname.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="hosts.xml"/> diff --git a/chapter07/console.xml b/chapter07/console.xml index c9e4242d5..377febfeb 100644 --- a/chapter07/console.xml +++ b/chapter07/console.xml @@ -4,22 +4,92 @@ %general-entities; ]> <sect1 id="ch-scripts-console"> -<title>Do I need the console script?</title> +<title>Configuring the Linux console</title> <?dbhtml filename="console.html"?> <indexterm zone="ch-scripts-console"> <primary sortas="d-console">console</primary> <secondary>configuring</secondary></indexterm> -<para>If you plan to compile the keymap directly in the kernel during <xref -linkend="chapter-bootable"/> (see <xref linkend="ch-system-kbd"/>), then strictly -speaking you don't need to run this loadkeys script, since the kernel will set -up the keymap for you. If you wish, you can still run the script, it isn't going -to hurt you. Keeping it could even be beneficial, in case you run a lot of -different kernels and can't be sure that the keymap is compiled into every one -of them.</para> +<para>In this section we will configure the <command>console</command> +initscript that sets up the keyboard +map and the console font. If you are a native English speaker so that you +don't need to use any non-ASCII characters, and your keyboard is a US one, +skip this section. Without the configuration file, +the <command>console</command> initscript will do nothing.</para> -<para>If you decided you don't need or don't want to use the console script, -remove the <filename class="symlink">/etc/rc.d/rcsysinit.d/S70console</filename> symlink.</para> +<para>The <command>console</command> script uses the +<filename>/etc/sysconfig/console</filename> +as a configuration file. You need to decide which keymap and screen font you +will use. The language-specific HOWTO can help you. +In the future releases of LFS-Bootscripts, there will be a pre-made +<filename>/etc/sysconfig/console</filename> file with known +good settings for several countries, and you will just have to uncomment +the relevant section. +If still in doubt, +look into <filename class="directory">/usr/share/kbd</filename> +for valid keymaps and screen fonts. Then read the <command>loadkeys</command> +and <command>setfont</command> manual pages and figure out the correct +arguments for these programs. +Once you decided, create the +configuration file with the following command:</para> + +<screen><userinput>cat >/etc/sysconfig/console <<"EOF"</userinput> +KEYMAP="<emphasis>arguments for loadkeys</emphasis>" +FONT="<emphasis>arguments for setfont</emphasis>" +<userinput>EOF</userinput></screen> + +<para>E.g., for Spanish users who also want to use the Euro character +(accessible by pressing Alt+E), +the following settings are correct:</para> + +<screen><userinput>cat >/etc/sysconfig/console <<"EOF"</userinput> +KEYMAP="es euro" +FONT="lat9-16 -u iso01" +<userinput>EOF</userinput></screen> + +<para>If the KEYMAP or FONT variable is not set, the console initscript +will not run the corresponding program.</para> + +<para>In some keymaps, the Backspace and Delete keys send characters +different form ones in the default keymap built into the kernel. +This confuses some applications, e.g. <application>Emacs</application> +displays its help (instead of erasing the character before the cursor) +when you press Backspace. To check if your keymap is affected (this works +only for i386 keymaps):</para> + +<screen><userinput>zgrep '\W14\W' <emphasis>/path/to/your/keymap</emphasis></userinput></screen> + +<para>If you see that keycode 14 is Backspace and not Delete, +create the following keymap snippet to fix this issue:</para> + +<screen><userinput>mkdir -p /etc/kbd & & cat >/etc/kbd/bs-sends-del <<"EOF"</userinput> + keycode 14 = Delete Delete Delete Delete + alt keycode 14 = Meta_Delete +altgr alt keycode 14 = Meta_Delete + keycode 111 = Remove +altgr control keycode 111 = Boot +control alt keycode 111 = Boot +altgr control alt keycode 111 = Boot +<userinput>EOF</userinput></screen> + +<para>Then tell the <command>console</command> script to load this snippet +after the main keymap:</para> + +<screen><userinput>cat >>/etc/sysconfig/console <<EOF</userinput> +KEYMAP_CORRECTION="/etc/kbd/bs-sends-del" +<userinput>EOF</userinput></screen> + +<para>If back in <xref linkend="chapter-building-system"/> you decided to go +compile your keymap directly into the kernel (later on in <xref +linkend="chapter-bootable"/>), then strictly speaking you don't need to run the +loadkeys program, since the kernel will set up the keymap for you, +and thus you may omit the KEYMAP variable from the +<filename>/etc/sysconfig/console</filename> +configuration file. If you wish, +you can still have it, this isn't going to hurt you. Keeping it could even +be beneficial, in case you run a lot of different kernels and can't be sure +that the keymap is compiled into every one of them.</para> </sect1> + diff --git a/chapter07/inputrc.xml b/chapter07/inputrc.xml new file mode 100644 index 000000000..f8327beb9 --- /dev/null +++ b/chapter07/inputrc.xml @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> +<sect1 id="ch-scripts-inputrc"> +<title>Creating the /etc/inputrc file</title> +<?dbhtml filename="inputrc.html"?> + +<para><filename>Inputrc</filename> deals with the mapping of the keyboard for +certain situations. This file is the start-up file used by +<application>readline</application> - the input related library used by +<application>Bash</application> and most other shells.</para> + +<para>For more information see <command>info bash</command> -- <emphasis +role="strong">Node: Readline Init</emphasis> file as well as +<command>info readline</command>. There is a lot that can be done with this +one rc file.</para> + +<para>Global values are set in <filename>/etc/inputrc</filename>. +Personal user values are set in <filename>~/.inputrc</filename>. The +<filename>~/.inputrc</filename> file will override the global settings +file. A later page sets up <application>Bash</application> to use +<filename>/etc/inputrc</filename> if there is no +<filename>.inputrc</filename> for a user when +<filename>/etc/profile</filename> is read (usually at login). If you +want your system to use both, or don't want <emphasis>global</emphasis> +keyboard handling, it is a good idea to place a default +<filename>.inputrc</filename> into the <filename>/etc/skel</filename> +directory for use with new users.</para> + +<para> +Below is a base <filename>/etc/inputrc</filename> along with +comments to explain what the various options do. Note that comments +can <emphasis>not</emphasis> be on the same line as commands. +</para> + +<para>If you will create an <filename>.inputrc</filename> in +<filename>/etc/skel</filename> using the command below, change the +command's output to <filename>/etc/skel/.inputrc</filename> and be +sure to check/set permissions afterward. Then you can just copy that +file to <filename>/etc/inputrc</filename> and the home directory +of any user already existing in the system, including root, that needs +a private version of the file. Be sure to use the <option>-p</option> parameter +of <command>cp</command> to maintain permissions and be sure to change owner and group +appropriately. +</para> + +<screen><userinput>cat > /etc/inputrc << "EOF"</userinput> +# Begin /etc/inputrc + +# Make sure we don't output everything on the 1 line +set horizontal-scroll-mode Off + +# Enable 8bit input +set meta-flag On +set input-meta On + +# Turns off 8th bit stripping +set convert-meta Off + +# Keep the 8th bit for display +set output-meta On + +# none, visible or audible +set bell-style none + +# All of the following map the escape sequence of the +# value contained inside the 1st argument to the +# readline specific functions + +"\eOd": backward-word +"\eOc": forward-word + +# for linux console +"\e[1~": beginning-of-line +"\e[4~": end-of-line +"\e[5~": beginning-of-history +"\e[6~": end-of-history +"\e[3~": delete-char +"\e[2~": quoted-insert + +# for xterm +"\eOH": beginning-of-line +"\eOF": end-of-line + +# for Konsole +"\e[H": beginning-of-line +"\e[F": end-of-line + +# End /etc/inputrc +<userinput>EOF</userinput></screen> + +</sect1> diff --git a/chapter07/profile.xml b/chapter07/profile.xml new file mode 100644 index 000000000..c9f6e16a4 --- /dev/null +++ b/chapter07/profile.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> +<sect1 id="ch-scripts-profile"> +<title>The Bash Shell Startup Files</title> +<?dbhtml filename="profile.html"?> + +<para>The shell program <filename>/bin/bash</filename> (hereafter +referred to as just "the shell") uses a collection of startup files to +help create an environment to run in. Each file has a specific use and +may affect login and interactive environments differently. The files in +the <filename class="directory">/etc</filename> directory generally provide global +settings. If an equivalent file exists in your home directory it may +override the global settings. +</para> + +<para>An interactive login shell is started after a successful login, using +<filename>/bin/login</filename>, by reading the +<filename>/etc/passwd</filename> file. An +interactive non-login shell is started at the command-line (e.g. +<prompt>[prompt]$</prompt><command>/bin/bash</command>). A non-interactive +shell is usually present when a shell script is running. It is non-interactive +because it is processing a script and not waiting for user input between +commands.</para> + +<para>For more information see <command>info bash</command> -- +<emphasis role="strong">Nodes: Bash Startup Files and Interactive +Shells.</emphasis></para> + +<para>The files <filename>/etc/profile</filename> and +<filename>~/.bash_profile</filename> are read when the shell is invoked +as an interactive login shell.</para> + +<para>A base <filename>/etc/profile</filename> created below only sets some +environment variables necessary for Bash to accept keystrokes properly, +even in non-English locale. Replace "ll" with the +two-letter code for your language (e.g. "en") and +"CC" with the two-letter code for your country +(e.g. "GB"). Also you may need to specify +(and this is actually the preferred form) your +character encoding (e.g. "iso8859-1") after a dot (so that the result +is "en_GB.iso8859-1"). +Issue the following command for more information:</para> + +<screen><userinput>man 3 setlocale</userinput></screen> + +<para>The list of all locales supported by glibc can be obtained by running +the following command:</para> + +<screen><userinput>locale -a</userinput></screen> + +<para>Now, when you are sure about your locale settings, create the +<filename>/etc/profile</filename> file:</para> +<screen><userinput>cat > /etc/profile << "EOF" +# Begin /etc/profile +# Written for Linux From Scratch +# by Alexander E. Patrakov + +export LC_ALL=ll_CC +export LANG=ll_CC +export INPUTRC=/etc/inputrc + +# End /etc/profile +EOF</userinput></screen> + +<para>Setting the keyboard layout, +the screen font and the locale-related environment variables +are the only internationalization steps needed to support +locales that use ordinary single-byte encodings and left-to-right +writing direction. More complex cases (including UTF-8 based locales) +require additional steps and additional patches because many applications +tend to break in such conditions. Because of too little educational +value for a typical reader, these steps and patches are not included +in the LFS book and such locales are not supported by LFS in any way. +</para> +</sect1> |