]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/init.d/console
console: add lat2-16 consolefont for polish to initskript.
[people/pmueller/ipfire-2.x.git] / src / initscripts / init.d / console
1 #!/bin/sh
2 ########################################################################
3 # Begin $rc_base/init.d/console
4 #
5 # Description : Sets keymap and screen font
6 #
7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
8 # Alexander E. Patrakov
9 #
10 # Version : 00.03
11 #
12 # Notes :
13 #
14 ########################################################################
15
16 . /etc/sysconfig/rc
17 . ${rc_functions}
18 eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
19
20 # English is default
21 FONT="lat0-16"
22 KEYMAP_CORRECTIONS="euro2"
23
24 if [ "$LANGUAGE" == "de" ]; then
25 LEGACY_CHARSET="iso-8859-15"
26 #FONT="LatArCyrHeb-16 -m 8859-15"
27 FONT="lat0-16 -m 8859-15"
28 fi
29
30 if [ "$LANGUAGE" == "pl" ]; then
31 FONT="lat2-16"
32 fi
33
34 UNICODE="1"
35 BROKEN_COMPOSE="0"
36
37 is_true() {
38 [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
39 }
40
41 failed=0
42 trap failed=1 ERR
43
44 case "${1}" in
45 start)
46 boot_mesg "Setting up Linux console..."
47 # There should be no bogus failures below this line!
48
49 # Figure out if a framebuffer console is used
50 [ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0
51
52 # Figure out the command to set the console into the
53 # desired mode
54 is_true "${UNICODE}" &&
55 MODE_COMMAND="echo -en '\033%G' && kbd_mode -u" ||
56 MODE_COMMAND="echo -en '\033%@\033(K' && kbd_mode -a"
57
58 # On framebuffer consoles, font has to be set for each vt in
59 # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
60
61 ! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
62 MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
63
64 # Apply that command to all consoles mentioned in
65 # /etc/inittab. Important: in the UTF-8 mode this should
66 # happen before setfont, otherwise a kernel bug will
67 # show up and the unicode map of the font will not be
68 # used.
69 # FIXME: Fedora Core also initializes two spare consoles
70 # - do we want that?
71
72 for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
73 grep -o '\btty[[:digit:]]*\b'`
74 do
75 openvt -f -w -c ${TTY#tty} -- \
76 /bin/sh -c "${MODE_COMMAND}" 2>/dev/null
77 done
78
79 # Set the font (if not already set above) and the keymap
80 is_true "${USE_FB}" || [ -z "${FONT}" ] || setfont $FONT
81 [ -z "${KEYMAP}" ] || loadkeys ${KEYMAP} &>/dev/null
82 [ -z "${KEYMAP_CORRECTIONS}" ] ||
83 loadkeys ${KEYMAP_CORRECTIONS} &>/dev/null
84
85 # Linux kernel generates wrong bytes when composing
86 # in Unicode mode. That's why we disable dead keys in Unicode
87 # mode by default. If you need them, download and apply
88 # http://www.linuxfromscratch.org/~alexander/patches/linux-2.6.12.5-utf8_input-2.patch
89 # After patching, add "-m charset_of_your_keymap" to the FONT
90 # variable and set BROKEN_COMPOSE=false
91 # in /etc/sysconfig/console
92
93 [ -n "$BROKEN_COMPOSE" ] || BROKEN_COMPOSE="$UNICODE"
94 ! is_true "$BROKEN_COMPOSE" ||
95 echo "" | loadkeys -c &>/dev/null
96
97 # Convert the keymap from $LEGACY_CHARSET to UTF-8
98 [ -z "$LEGACY_CHARSET" ] ||
99 dumpkeys -c "$LEGACY_CHARSET" | loadkeys -u &>/dev/null
100
101 # If any of the commands above failed, the trap at the
102 # top would set $failed to 1
103 ( exit $failed )
104 evaluate_retval
105 ;;
106 *)
107 echo $"Usage:" "${0} {start}"
108 exit 1
109 ;;
110 esac
111
112 # End $rc_base/init.d/console