]>
git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blob - src/initscripts/system/console
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 eval $
(/usr
/local
/bin
/readhash
/var
/ipfire
/main
/settings
)
26 FONT
="latarcyrheb-sun16"
27 KEYMAP_CORRECTIONS
="euro2"
32 [ "$1" = "1" ] ||
[ "$1" = "yes" ] ||
[ "$1" = "true" ]
40 boot_mesg
"Setting up Linux console..."
41 # There should be no bogus failures below this line!
43 # Figure out if a framebuffer console is used
44 [ -d /sys
/class
/graphics
/fb0
] && USE_FB
=1 || USE_FB
=0
46 # Figure out the command to set the console into the
48 is_true
"${UNICODE}" &&
49 MODE_COMMAND
="echo -en '\033%G' && kbd_mode -u" ||
50 MODE_COMMAND
="echo -en '\033%@\033(K' && kbd_mode -a"
52 # On framebuffer consoles, font has to be set for each vt in
53 # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
55 ! is_true
"${USE_FB}" ||
[ -z "${FONT}" ] ||
56 MODE_COMMAND
="${MODE_COMMAND} && setfont ${FONT}"
58 # Apply that command to all consoles mentioned in
59 # /etc/inittab. Important: in the UTF-8 mode this should
60 # happen before setfont, otherwise a kernel bug will
61 # show up and the unicode map of the font will not be
63 # FIXME: Fedora Core also initializes two spare consoles
66 for TTY
in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
67 grep -o '\btty[[:digit:]]*\b'`
69 openvt
-f -w -c ${TTY#tty} -- \
70 /bin
/sh
-c "${MODE_COMMAND}" 2>/dev
/null
73 # Set the font (if not already set above) and the keymap
74 is_true
"${USE_FB}" ||
[ -z "${FONT}" ] || setfont
$FONT
75 [ -z "${KEYMAP}" ] || loadkeys
${KEYMAP} &>/dev
/null
76 [ -z "${KEYMAP_CORRECTIONS}" ] ||
77 loadkeys
${KEYMAP_CORRECTIONS} &>/dev
/null
79 # Linux kernel generates wrong bytes when composing
80 # in Unicode mode. That's why we disable dead keys in Unicode
81 # mode by default. If you need them, download and apply
82 # http://www.linuxfromscratch.org/~alexander/patches/linux-2.6.12.5-utf8_input-2.patch
83 # After patching, add "-m charset_of_your_keymap" to the FONT
84 # variable and set BROKEN_COMPOSE=false
85 # in /etc/sysconfig/console
87 [ -n "$BROKEN_COMPOSE" ] || BROKEN_COMPOSE
="$UNICODE"
88 ! is_true
"$BROKEN_COMPOSE" ||
89 echo "" | loadkeys
-c &>/dev
/null
91 # Convert the keymap from $LEGACY_CHARSET to UTF-8
92 [ -z "$LEGACY_CHARSET" ] ||
93 dumpkeys
-c "$LEGACY_CHARSET" | loadkeys
-u &>/dev
/null
95 # If any of the commands above failed, the trap at the
96 # top would set $failed to 1
101 echo $
"Usage:" "${0} {start}"