2013-02-12 17:09:50 -05:00
|
|
|
#!@SBINDIR@/runscript
|
2009-05-01 15:11:40 +01:00
|
|
|
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
2011-06-29 19:46:31 -04:00
|
|
|
# Released under the 2-clause BSD license.
|
2007-11-14 15:22:04 +00:00
|
|
|
|
2007-07-10 19:09:41 +00:00
|
|
|
description="Applies a keymap for the consoles."
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
depend()
|
|
|
|
{
|
2008-03-27 13:49:49 +00:00
|
|
|
need localmount termencoding
|
2009-04-27 07:51:18 +00:00
|
|
|
after bootmisc
|
2012-07-02 22:04:22 -05:00
|
|
|
keyword -openvz -prefix -uml -vserver -xenu -lxc
|
2007-04-05 11:18:42 +00:00
|
|
|
}
|
|
|
|
|
2008-01-11 12:13:46 +00:00
|
|
|
start()
|
|
|
|
{
|
2009-04-27 07:51:18 +00:00
|
|
|
ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
|
|
|
|
: ${unicode:=$UNICODE}
|
2009-11-13 22:21:04 +00:00
|
|
|
: ${keymap:=$KEYMAP}
|
2009-04-27 07:51:18 +00:00
|
|
|
: ${extended_keymaps:=$EXTENDED_KEYMAPS}
|
2011-01-17 04:49:07 -05:00
|
|
|
: ${windowkeys:=$SET_WINDOWSKEYS}
|
2009-04-27 07:51:18 +00:00
|
|
|
: ${fix_euro:=$FIX_EURO}
|
|
|
|
: ${dumpkeys_charset:=${DUMPKEYS_CHARSET}}
|
|
|
|
|
|
|
|
if [ -z "$keymap" ]; then
|
2007-11-23 22:23:20 +00:00
|
|
|
eerror "You need to setup keymap in /etc/conf.d/keymaps first"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2008-03-27 13:49:49 +00:00
|
|
|
local ttydev=/dev/tty n=
|
|
|
|
[ -d /dev/vc ] && ttydev=/dev/vc/
|
2007-04-05 11:18:42 +00:00
|
|
|
|
|
|
|
# Force linux keycodes for PPC.
|
2007-11-28 15:45:03 +00:00
|
|
|
if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]; then
|
2007-04-05 11:18:42 +00:00
|
|
|
echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
|
|
|
|
fi
|
|
|
|
|
2009-11-13 22:21:04 +00:00
|
|
|
local wkeys= kmode="-a" msg="ASCII"
|
2009-04-27 07:51:18 +00:00
|
|
|
if yesno $unicode; then
|
2008-03-27 13:49:49 +00:00
|
|
|
kmode="-u"
|
|
|
|
msg="UTF-8"
|
|
|
|
fi
|
2009-04-27 07:51:18 +00:00
|
|
|
yesno $windowkeys && wkeys="windowkeys"
|
2007-04-05 11:18:42 +00:00
|
|
|
|
|
|
|
# Set terminal encoding to either ASCII or UNICODE.
|
|
|
|
# See utf-8(7) for more information.
|
2009-04-27 07:51:18 +00:00
|
|
|
ebegin "Setting keyboard mode [$msg]"
|
2007-09-28 12:54:48 +00:00
|
|
|
n=1
|
2009-04-27 07:51:18 +00:00
|
|
|
while [ $n -le $ttyn ]; do
|
|
|
|
kbd_mode $kmode -C $ttydev$n
|
2011-11-10 21:46:08 -05:00
|
|
|
: $(( n += 1 ))
|
2007-04-05 11:18:42 +00:00
|
|
|
done
|
|
|
|
eend 0
|
2009-04-26 11:19:22 +00:00
|
|
|
|
2009-11-13 22:21:04 +00:00
|
|
|
ebegin "Loading key mappings [$keymap]"
|
|
|
|
loadkeys -q $wkeys $keymap $extended_keymaps
|
|
|
|
eend $? "Error loading key mappings" || return $?
|
|
|
|
|
|
|
|
if yesno $fix_euro; then
|
|
|
|
ebegin "Fixing font for euro symbol"
|
|
|
|
# Fix some fonts displaying the Euro, #173528.
|
2013-02-15 16:09:49 -06:00
|
|
|
echo "altgr keycode 18 = U+20AC" | loadkeys -q -
|
2009-11-13 22:21:04 +00:00
|
|
|
eend $?
|
|
|
|
fi
|
|
|
|
|
2009-04-26 11:19:22 +00:00
|
|
|
# Save the keymapping for use immediately at boot
|
2012-01-28 19:32:05 +01:00
|
|
|
if checkpath -W "$RC_LIBEXECDIR"; then
|
2009-05-23 20:38:12 +01:00
|
|
|
mkdir -p "$RC_LIBEXECDIR"/console
|
|
|
|
dumpkeys >"$RC_LIBEXECDIR"/console/keymap
|
2009-04-26 11:19:22 +00:00
|
|
|
fi
|
2007-04-05 11:18:42 +00:00
|
|
|
}
|