]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/blob - udev/console_init
Change file layout of the makefiles.
[people/amarx/ipfire-3.x.git] / udev / console_init
1 #!/bin/bash
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2008 Michael Tremer & Christian Schmidt #
6 # #
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. #
11 # #
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. #
16 # #
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/>. #
19 # #
20 ###############################################################################
21
22 is_true() {
23 [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
24 }
25
26 # Native English speakers probably don't have /etc/sysconfig/console at all
27 if [ -f /etc/sysconfig/console ]; then
28 . /etc/sysconfig/console
29 fi
30
31 # Setting default values
32 [ -z "$UNICODE" ] && UNICODE=1
33 [ -z "$FONT" ] && FONT="LatArCyrHeb-16"
34
35 device="/dev/$1"
36
37 # Figure out the mode to set the console into
38 if is_true "${UNICODE}"; then
39 echo -en '\033%G' > $device
40 else
41 echo -en '\033%@' > $device
42 fi
43
44 # Setting font
45 setfont ${FONT} -C $device
46
47 # Setting up keyboard
48 if [ -n "$KEYMAP" ]; then
49 if is_true "${UNICODE}"; then
50 loadkeys -u $KEYMAP >/dev/null
51 else
52 loadkeys $KEYMAP >/dev/null
53 fi
54 [ -n "$KEYMAP_CORRECTIONS" ] && \
55 loadkeys $KEYMAP_CORRECTIONS >/dev/null
56 fi