From b32e80330973383d4eca995d6193e35a743176cd Mon Sep 17 00:00:00 2001 From: Zack Winkles Date: Thu, 6 May 2004 16:22:04 +0000 Subject: Committed Alexander's i18n patch git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3489 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter07/bootscripts.xml | 16 +++++--- chapter07/chapter07.xml | 2 + chapter07/console.xml | 90 ++++++++++++++++++++++++++++++++++++++++----- chapter07/inputrc.xml | 94 +++++++++++++++++++++++++++++++++++++++++++++++ chapter07/profile.xml | 78 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 264 insertions(+), 16 deletions(-) create mode 100644 chapter07/inputrc.xml create mode 100644 chapter07/profile.xml (limited to 'chapter07') 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 @@ Contents of LFS-bootscripts -Installed scripts: checkfs, cleanfs, functions, -halt, ifdown, ifup, loadkeys, localnet, mountfs, mountkernfs, network, rc, +Installed scripts: checkfs, cleanfs, +console, +functions, halt, ifdown, ifup, +localnet, mountfs, mountkernfs, network, rc, reboot, sendsignals, setclock, static, swap, sysklogd and template @@ -51,6 +53,12 @@ preserved between reboots, such as those in /var/run/ and and removes the possibly present /etc/nologin, /fastboot and /forcefsck files. +console +The console script +loads the keymap table you +specified as proper for your keyboard layout. +It also sets the screen font. + functions The functions script contains functions shared among different scripts, such as error and status checking. @@ -62,10 +70,6 @@ different scripts, such as error and status checking. The ifdown and ifup scripts assist the network script with network devices. -loadkeys -The loadkeys script loads the keymap table you -specified as proper for your keyboard layout. - localnet The localnet script sets up the system's hostname and local loopback device. 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 @@ + + 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; ]> -Do I need the console script? +Configuring the Linux console console configuring -If you plan to compile the keymap directly in the kernel during (see ), 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. +In this section we will configure the console +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 console initscript will do nothing. -If you decided you don't need or don't want to use the console script, -remove the /etc/rc.d/rcsysinit.d/S70console symlink. +The console script uses the +/etc/sysconfig/console +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 +/etc/sysconfig/console file with known +good settings for several countries, and you will just have to uncomment +the relevant section. +If still in doubt, +look into /usr/share/kbd +for valid keymaps and screen fonts. Then read the loadkeys +and setfont manual pages and figure out the correct +arguments for these programs. +Once you decided, create the +configuration file with the following command: + +cat >/etc/sysconfig/console <<"EOF" +KEYMAP="arguments for loadkeys" +FONT="arguments for setfont" +EOF + +E.g., for Spanish users who also want to use the Euro character +(accessible by pressing Alt+E), +the following settings are correct: + +cat >/etc/sysconfig/console <<"EOF" +KEYMAP="es euro" +FONT="lat9-16 -u iso01" +EOF + +If the KEYMAP or FONT variable is not set, the console initscript +will not run the corresponding program. + +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. Emacs +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): + +zgrep '\W14\W' /path/to/your/keymap + +If you see that keycode 14 is Backspace and not Delete, +create the following keymap snippet to fix this issue: + +mkdir -p /etc/kbd & & cat >/etc/kbd/bs-sends-del <<"EOF" + 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 +EOF + +Then tell the console script to load this snippet +after the main keymap: + +cat >>/etc/sysconfig/console <<EOF +KEYMAP_CORRECTION="/etc/kbd/bs-sends-del" +EOF + +If back in you decided to go +compile your keymap directly into the kernel (later on in ), 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 +/etc/sysconfig/console +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. + 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 @@ + + + %general-entities; +]> + +Creating the /etc/inputrc file + + +Inputrc deals with the mapping of the keyboard for +certain situations. This file is the start-up file used by +readline - the input related library used by +Bash and most other shells. + +For more information see info bash -- Node: Readline Init file as well as +info readline. There is a lot that can be done with this +one rc file. + +Global values are set in /etc/inputrc. +Personal user values are set in ~/.inputrc. The +~/.inputrc file will override the global settings +file. A later page sets up Bash to use +/etc/inputrc if there is no +.inputrc for a user when +/etc/profile is read (usually at login). If you +want your system to use both, or don't want global +keyboard handling, it is a good idea to place a default +.inputrc into the /etc/skel +directory for use with new users. + + +Below is a base /etc/inputrc along with +comments to explain what the various options do. Note that comments +can not be on the same line as commands. + + +If you will create an .inputrc in +/etc/skel using the command below, change the +command's output to /etc/skel/.inputrc and be +sure to check/set permissions afterward. Then you can just copy that +file to /etc/inputrc 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 parameter +of cp to maintain permissions and be sure to change owner and group +appropriately. + + +cat > /etc/inputrc << "EOF" +# 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 +EOF + + 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 @@ + + + %general-entities; +]> + +The Bash Shell Startup Files + + +The shell program /bin/bash (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 /etc directory generally provide global +settings. If an equivalent file exists in your home directory it may +override the global settings. + + +An interactive login shell is started after a successful login, using +/bin/login, by reading the +/etc/passwd file. An +interactive non-login shell is started at the command-line (e.g. +[prompt]$/bin/bash). 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. + +For more information see info bash -- +Nodes: Bash Startup Files and Interactive +Shells. + +The files /etc/profile and +~/.bash_profile are read when the shell is invoked +as an interactive login shell. + +A base /etc/profile 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: + +man 3 setlocale + +The list of all locales supported by glibc can be obtained by running +the following command: + +locale -a + +Now, when you are sure about your locale settings, create the +/etc/profile file: +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 + +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. + + -- cgit v1.2.3-54-g00ecf