diff options
-rw-r--r-- | main/kbd/APKBUILD | 16 | ||||
-rw-r--r-- | main/kbd/loadkeys.confd | 23 | ||||
-rw-r--r-- | main/kbd/loadkeys.initd | 72 |
3 files changed, 109 insertions, 2 deletions
diff --git a/main/kbd/APKBUILD b/main/kbd/APKBUILD index 22707dea66..45a122e25d 100644 --- a/main/kbd/APKBUILD +++ b/main/kbd/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=kbd pkgver=2.0.4 -pkgrel=2 +pkgrel=3 pkgdesc="Tools for configuring the console (keyboard, virtual terminals, etc.)" url="http://ftp.altlinux.org/pub/people/legion/kbd" arch="all" @@ -10,12 +10,17 @@ license="GPL-2.0-or-later" depends="kbd-misc" makedepends="linux-headers linux-pam-dev check-dev ckbcomp xkeyboard-config" install="" -subpackages="$pkgname-bkeymaps::noarch $pkgname-legacy::noarch $pkgname-misc::noarch $pkgname-doc $pkgname-vlock" +subpackages="$pkgname-bkeymaps::noarch $pkgname-legacy::noarch + $pkgname-misc::noarch $pkgname-doc $pkgname-openrc $pkgname-vlock" source="https://www.kernel.org/pub/linux/utils/kbd/kbd-$pkgver.tar.gz + loadkeys.initd + loadkeys.confd + error.h fix-tests.patch " builddir="$srcdir"/kbd-$pkgver + _datadir=/usr/share _xmapdir="$_datadir"/keymaps/xkb _bmapdir="$_datadir"/bkeymaps @@ -62,6 +67,11 @@ package() { cd "$builddir" make DESTDIR="$pkgdir" install + install -Dm755 "$srcdir"/loadkeys.initd \ + "$pkgdir"/etc/init.d/loadkeys + install -Dm644 "$srcdir"/loadkeys.confd \ + "$pkgdir"/etc/conf.d/loadkeys + # Move and fixup legacy keymaps mkdir legacy mv "$pkgdir"/usr/share/keymaps/* legacy @@ -165,5 +175,7 @@ misc() { } sha512sums="e37bc661c75a8363e9a5ba903310fa7f7ded4f381c2c77aa7edc0b1aca5a63224933fd113cddcf180e7fb85f55407e0d1f47be1cdf69dcf2787e83ac996bbf03 kbd-2.0.4.tar.gz +64b5ab4c362350521da8f507d22c0b77784da99bbe1b32f0c001cd826f63c607e3f9cd6af01f06a61af8bd709760bbf2bb3cfe2010c33925f2987a1af6ef4998 loadkeys.initd +12028796552a5ffed1d5cb19d37fc6a73fb4f2e2bf34d837a81171c7ebee98d6c3f557715bf79706d79ce053b9b2450cd8cf1c4ea045428fb7d8a5915ae3ed78 loadkeys.confd c66f6b0d8c8b8d285c740bdbe7130dee272ac01cd5e73b35a58cedf1a77fe8d9e062631b804fb58014d8eb9861c8f28aed07bc022ef31662bcc61b5c85a21752 error.h bb67e5bb933a48f4a04402e07d7d67169a97485e6b469f8ccd4436466eb17ec2ddcf0ef74d22b3aae9e813feaee5bef0822ec50c384e0276a8c91f9325502a5f fix-tests.patch" diff --git a/main/kbd/loadkeys.confd b/main/kbd/loadkeys.confd new file mode 100644 index 0000000000..1ba568af9e --- /dev/null +++ b/main/kbd/loadkeys.confd @@ -0,0 +1,23 @@ +# Use keymap to specify the default console keymap. There is a complete tree +# of keymaps in /usr/share/keymaps to choose from. +keymap="us" + +# Should we first load the 'windowkeys' console keymap? Most x86 users will +# say "yes" here. Note that non-x86 users should leave it as "no". +# Loading this keymap will enable VT switching (like ALT+Left/Right) +# using the special windows keys on the linux console. +windowkeys="NO" + +# The maps to load for extended keyboards. Most users will leave this as is. +extended_keymaps="" +#extended_keymaps="backspace keypad euro2" + +# Tell dumpkeys(1) to interpret character action codes to be +# from the specified character set. +# This only matters if you set unicode="yes" in /etc/rc.conf. +# For a list of valid sets, run `dumpkeys --help` +dumpkeys_charset="" + +# Some fonts map AltGr-E to the currency symbol instead of the Euro. +# To fix this, set to "yes" +fix_euro="NO" diff --git a/main/kbd/loadkeys.initd b/main/kbd/loadkeys.initd new file mode 100644 index 0000000000..6686bf0e52 --- /dev/null +++ b/main/kbd/loadkeys.initd @@ -0,0 +1,72 @@ +#!/sbin/openrc-run +# Copyright (c) 2007-2015 The OpenRC Authors. +# See the Authors file at the top-level directory of this distribution and +# https://github.com/OpenRC/openrc/blob/master/AUTHORS +# +# This file is part of OpenRC. It is subject to the license terms in +# the LICENSE file found in the top-level directory of this +# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE +# This file may not be copied, modified, propagated, or distributed +# except according to the terms contained in the LICENSE file. + +description="Applies a keymap for the consoles." + +depend() +{ + provide keymaps + need localmount termencoding + after bootmisc + keyword -docker -lxc -openvz -prefix -systemd-nspawn -uml -vserver -xenu +} + +start() +{ + ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} + : ${unicode:=$UNICODE} + : ${keymap:=$KEYMAP} + : ${extended_keymaps:=$EXTENDED_KEYMAPS} + : ${windowkeys:=$SET_WINDOWSKEYS} + : ${fix_euro:=$FIX_EURO} + : ${dumpkeys_charset:=${DUMPKEYS_CHARSET}} + + if [ -z "$keymap" ]; then + eerror "You need to setup keymap in /etc/conf.d/${0##*/} first" + return 1 + fi + + local ttydev=/dev/tty n= + [ -d /dev/vc ] && ttydev=/dev/vc/ + + # Force linux keycodes for PPC. + if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]; then + echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes + fi + + local wkeys= kmode="-a" msg="ASCII" + if yesno $unicode; then + kmode="-u" + msg="UTF-8" + fi + yesno $windowkeys && wkeys="windowkeys" + + # Set terminal encoding to either ASCII or UNICODE. + # See utf-8(7) for more information. + ebegin "Setting keyboard mode [$msg]" + n=1 + while [ $n -le $ttyn ]; do + kbd_mode $kmode -C $ttydev$n + : $(( n += 1 )) + done + eend 0 + + 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. + echo "altgr keycode 18 = U+20AC" | loadkeys -q - + eend $? + fi +} |