2
########################################################################
3
# Begin $rc_base/init.d/console
5
# Description : Sets keymap and screen font
7
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
8
# Alexander E. Patrakov
14
########################################################################
19
# Native English speakers probably don't have /etc/sysconfig/console at all
20
if [ -f /etc/sysconfig/console ]
22
. /etc/sysconfig/console
28
[ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
36
boot_mesg "Setting up Linux console..."
37
# There should be no bogus failures below this line!
39
# Figure out if a framebuffer console is used
40
[ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0
42
# Figure out the command to set the console into the
44
is_true "${UNICODE}" &&
45
MODE_COMMAND="echo -en '\033%G' && kbd_mode -u" ||
46
MODE_COMMAND="echo -en '\033%@\033(K' && kbd_mode -a"
48
# On framebuffer consoles, font has to be set for each vt in
49
# UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
51
! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
52
MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
54
# Apply that command to all consoles mentioned in
55
# /etc/inittab. Important: in the UTF-8 mode this should
56
# happen before setfont, otherwise a kernel bug will
57
# show up and the unicode map of the font will not be
59
# FIXME: Fedora Core also initializes two spare consoles
62
for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
63
grep -o '\btty[[:digit:]]*\b'`
65
openvt -f -w -c ${TTY#tty} -- \
66
/bin/sh -c "${MODE_COMMAND}"
69
# Set the font (if not already set above) and the keymap
70
is_true "${USE_FB}" || [ -z "${FONT}" ] || setfont $FONT
71
[ -z "${KEYMAP}" ] || loadkeys ${KEYMAP} &>/dev/null
72
[ -z "${KEYMAP_CORRECTIONS}" ] ||
73
loadkeys ${KEYMAP_CORRECTIONS} &>/dev/null
75
# Linux kernel generates wrong bytes when composing
76
# in Unicode mode. That's why we disable dead keys in Unicode
77
# mode by default. If you need them, download and apply
78
# http://www.linuxfromscratch.org/~alexander/patches/linux-2.6.12.5-utf8_input-2.patch
79
# After patching, add "-m charset_of_your_keymap" to the FONT
80
# variable and set BROKEN_COMPOSE=false
81
# in /etc/sysconfig/console
83
[ -n "$BROKEN_COMPOSE" ] || BROKEN_COMPOSE="$UNICODE"
84
! is_true "$BROKEN_COMPOSE" ||
85
echo "" | loadkeys -c &>/dev/null
87
# Convert the keymap from $LEGACY_CHARSET to UTF-8
88
[ -z "$LEGACY_CHARSET" ] ||
89
dumpkeys -c "$LEGACY_CHARSET" | loadkeys -u &>/dev/null
91
# If any of the commands above failed, the trap at the
92
# top would set $failed to 1
97
echo $"Usage:" "${0} {start}"
102
# End $rc_base/init.d/console