/[vps]/baselayout-vserver/trunk/init.d/keymaps
Gentoo

Contents of /baselayout-vserver/trunk/init.d/keymaps

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations) (download)
Sat Sep 3 16:10:27 2005 UTC (9 years, 5 months ago) by hollow
File size: 1859 byte(s)
import initial baselayout sources (1.12.0_pre8)
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 # Turn on unicode if user wants it
38 if [[ ${UNICODE} == "yes" ]] ; then
39 /usr/bin/kbd_mode -u
40 fi
41
42 ebegin "Loading key mappings"
43 if [[ -x /bin/loadkeys ]] ; then
44 [[ ${SET_WINDOWKEYS} == "yes" ]] && WINDOWKEYS_KEYMAP="windowkeys"
45 /bin/loadkeys -q ${WINDOWKEYS_KEYMAP} ${KEYMAP} \
46 ${EXTENDED_KEYMAPS} > /dev/null
47 eend $? "Error loading key mappings"
48 else
49 eend 1 "/bin/loadkeys not found"
50 return 1
51 fi
52
53 # Set terminal encoding to either ASCII or UNICODE.
54 # See utf-8(7) for more information.
55 local termencoding="" termmsg=""
56 if [[ ${UNICODE} == "yes" ]] ; then
57 local dumpkey_opts=""
58 [[ -n ${DUMPKEYS_CHARSET} ]] && dumpkey_opts="-c ${DUMPKEYS_CHARSET}"
59
60 dumpkeys ${dumpkey_opts} | loadkeys --unicode
61 termencoding=$'\033%G'
62 termmsg="UTF-8"
63 else
64 termencoding=$'\033(K'
65 termmsg="ASCII"
66 fi
67 local n ttydev=""
68 [[ -d /dev/vc ]] \
69 && ttydev=/dev/vc/ \
70 || ttydev=/dev/tty
71 ebegin "Setting terminal encoding to ${termmsg}"
72 for n in $(seq 1 "${RC_TTY_NUMBER}") ; do
73 echo -n -e ${termencoding} > ${ttydev}${n}
74 done
75 eend 0
76 }
77
78
79 # vim:ts=4

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20