/[baselayout]/branches/rc-scripts-1_6/init.d/keymaps
Gentoo

Contents of /branches/rc-scripts-1_6/init.d/keymaps

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1231 - (show annotations) (download)
Mon Jun 13 02:25:31 2005 UTC (9 years, 1 month ago) by vapier
File size: 1801 byte(s)
merge cvs Header removal from trunk
1 #!/sbin/runscript
2 # Copyright 1999-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 depend() {
6 need localmount
7 }
8
9 checkconfig() {
10 if [[ -z ${KEYMAP} ]] ; then
11 eerror "You need to setup KEYMAP in /etc/conf.d/keymaps first"
12 return 1
13 fi
14
15 # Make sure user isn't using rc.conf anymore
16 if grep -qs ^KEYMAP= /etc/rc.conf ; then
17 ewarn "KEYMAP should not be set in /etc/rc.conf but in /etc/conf.d/keymaps"
18 fi
19 }
20
21 start() {
22 if is_uml_sys ; then
23 ebegin "Loading key mappings"
24 eend 0
25 return 0
26 fi
27
28 local WINDOWKEYS_KEYMAP=
29
30 checkconfig || return 1
31
32 # Force linux keycodes for PPC.
33 if [[ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]] ; then
34 echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
35 fi
36
37 # New kbd support.
38 ebegin "Loading key mappings"
39 if [[ -x /bin/loadkeys ]] ; then
40 [[ ${SET_WINDOWKEYS} == "yes" ]] && WINDOWKEYS_KEYMAP="windowkeys"
41 /bin/loadkeys -q ${WINDOWKEYS_KEYMAP} ${KEYMAP} \
42 ${EXTENDED_KEYMAPS} > /dev/null
43 eend $? "Error loading key mappings"
44 else
45 eend 1 "/bin/loadkeys not found"
46 return 1
47 fi
48
49 # Set terminal encoding to either ASCII or UNICODE.
50 # See utf-8(7) for more information.
51 local termencoding="" termmsg=""
52 if [[ ${UNICODE} == "yes" ]] ; then
53 local dumpkey_opts=""
54 [[ -n ${DUMPKEYS_CHARSET} ]] && dumpkey_opts="-c ${DUMPKEYS_CHARSET}"
55
56 /usr/bin/kbd_mode -u
57 dumpkeys ${dumpkey_opts} | loadkeys --unicode
58 termencoding=$'\033%G'
59 termmsg="UTF-8"
60 else
61 termencoding=$'\033(K'
62 termmsg="ASCII"
63 fi
64 local n ttydev=""
65 [[ -d /dev/vc ]] \
66 && ttydev=/dev/vc/ \
67 || ttydev=/dev/tty
68 ebegin "Setting terminal encoding to ${termmsg}"
69 for n in $(seq 1 "${RC_TTY_NUMBER}") ; do
70 echo -n -e ${termencoding} > ${ttydev}${n}
71 done
72 eend 0
73 }
74
75
76 # vim:ts=4

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20