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 /chapter07 | |
parent | 4dc8dc63eef4a0b4e70ffa3ff12d8678a6a81e92 (diff) |
Committed Alexander's i18n patch
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3489 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter07')
-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 |
5 files changed, 264 insertions, 16 deletions
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> |