/[baselayout]/trunk/init.d.Linux/keymaps
Gentoo

Contents of /trunk/init.d.Linux/keymaps

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2952 - (show annotations) (download)
Fri Sep 28 12:54:48 2007 UTC (6 years, 9 months ago) by uberlord
File size: 2196 byte(s)
    keymaps now sets unicode keyboard on all defined ttys, #192442 
    thanks to Pacho Ramos.
1 #!/sbin/runscript
2 # Copyright 1999-2007 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 description="Applies a keymap for the consoles."
6
7 depend() {
8 need localmount
9 }
10
11 checkconfig() {
12 if [ -z "${KEYMAP}" ] ; then
13 eerror "You need to setup KEYMAP in /etc/conf.d/keymaps first"
14 return 1
15 fi
16
17 # Make sure user isn't using rc.conf anymore
18 if grep -q "^KEYMAP=" /etc/rc.conf ; then
19 ewarn "KEYMAP should not be set in /etc/rc.conf but in /etc/conf.d/keymaps"
20 fi
21 }
22
23 start() {
24 case "${RC_SYS}" in
25 UML|VPS|XEN)
26 ebegin "Loading key mappings"
27 eend 0
28 return 0
29 ;;
30 esac
31
32 local WINDOWKEYS_KEYMAP= LOADKEYS_UNI=
33 local ttydev= n=
34 [ -d /dev/vc ] \
35 && ttydev=/dev/vc/ \
36 || ttydev=/dev/tty
37
38 checkconfig || return 1
39
40 # Force linux keycodes for PPC.
41 if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ] ; then
42 echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
43 fi
44
45 # Turn on unicode if user wants it
46 if [ "${UNICODE}" = "yes" ]; then
47 n=1
48 while [ ${n} -le "${RC_TTY_NUMBER}" ]; do
49 kbd_mode -u -C "${ttydev}${n}"
50 n=$((${n} + 1))
51 done
52 LOADKEYS_UNI="--unicode"
53 fi
54
55 ebegin "Loading key mappings"
56 if [ -x /bin/loadkeys ] ; then
57 [ "${SET_WINDOWKEYS}" = "yes" ] && WINDOWKEYS_KEYMAP="windowkeys"
58 loadkeys -q ${LOADKEYS_UNI} ${WINDOWKEYS_KEYMAP} ${KEYMAP} \
59 ${EXTENDED_KEYMAPS}
60 eend $? "Error loading key mappings"
61
62 if [ "${FIX_EURO}" = "yes" ] ; then
63 # Fix some fonts displaying the Euro, #173528.
64 echo "altgr keycode 18 = U+20AC" | loadkeys -q
65 fi
66 else
67 eend 1 "/bin/loadkeys not found"
68 return 1
69 fi
70
71 # Set terminal encoding to either ASCII or UNICODE.
72 # See utf-8(7) for more information.
73 local termencoding= termmsg=
74 if [ "${UNICODE}" = "yes" ] ; then
75 local dumpkey_opts=
76 [ -n "${DUMPKEYS_CHARSET}" ] && dumpkey_opts="-c ${DUMPKEYS_CHARSET}"
77
78 dumpkeys ${dumpkey_opts} | loadkeys --unicode
79 termencoding="%G"
80 termmsg="UTF-8"
81 else
82 termencoding="%@"
83 termmsg="ASCII"
84 fi
85
86 ebegin "Setting terminal encoding to" ${termmsg}
87 n=1
88 while [ ${n} -le "${RC_TTY_NUMBER}" ] ; do
89 printf "\033%s" "${termencoding}" >"${ttydev}${n}"
90 n=$((${n} + 1))
91 done
92 eend 0
93 }
94
95
96 # vim:ts=4

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20