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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2763 - (show annotations) (download)
Tue Jul 10 19:09:41 2007 UTC (7 years, 2 months ago) by uberlord
File size: 2096 byte(s)
init scripts and their extra options can now have descriptions, #184327.
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
34 checkconfig || return 1
35
36 # Force linux keycodes for PPC.
37 if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ] ; then
38 echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
39 fi
40
41 # Turn on unicode if user wants it
42 if [ "${UNICODE}" = "yes" ] ; then
43 kbd_mode -u
44 LOADKEYS_UNI="--unicode"
45 fi
46
47 ebegin "Loading key mappings"
48 if [ -x /bin/loadkeys ] ; then
49 [ "${SET_WINDOWKEYS}" = "yes" ] && WINDOWKEYS_KEYMAP="windowkeys"
50 loadkeys -q ${LOADKEYS_UNI} ${WINDOWKEYS_KEYMAP} ${KEYMAP} \
51 ${EXTENDED_KEYMAPS}
52 eend $? "Error loading key mappings"
53
54 if [ "${FIX_EURO}" = "yes" ] ; then
55 # Fix some fonts displaying the Euro, #173528.
56 echo "altgr keycode 18 = U+20AC" | loadkeys -q
57 fi
58 else
59 eend 1 "/bin/loadkeys not found"
60 return 1
61 fi
62
63 # Set terminal encoding to either ASCII or UNICODE.
64 # See utf-8(7) for more information.
65 local termencoding= termmsg=
66 if [ "${UNICODE}" = "yes" ] ; then
67 local dumpkey_opts=
68 [ -n "${DUMPKEYS_CHARSET}" ] && dumpkey_opts="-c ${DUMPKEYS_CHARSET}"
69
70 dumpkeys ${dumpkey_opts} | loadkeys --unicode
71 termencoding="%G"
72 termmsg="UTF-8"
73 else
74 termencoding="%@"
75 termmsg="ASCII"
76 fi
77 local n=1 ttydev=
78 [ -d /dev/vc ] \
79 && ttydev=/dev/vc/ \
80 || ttydev=/dev/tty
81 ebegin "Setting terminal encoding to" ${termmsg}
82 while [ ${n} -le "${RC_TTY_NUMBER}" ] ; do
83 printf "\033%s" "${termencoding}" >"${ttydev}${n}"
84 n=$((${n} + 1))
85 done
86 eend 0
87 }
88
89
90 # vim:ts=4

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20