temp/kbd: new aport (!572)
[ci:skip-build]: already built successfully in CI
This commit is contained in:
parent
13fa90dc88
commit
6b0aae4442
9 changed files with 450 additions and 0 deletions
|
@ -0,0 +1,68 @@
|
|||
From 7e27102b6fc6991a6a4eca422b513781a26b1639 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Gladkov <gladkov.alexey@gmail.com>
|
||||
Date: Wed, 21 Aug 2019 13:29:16 +0200
|
||||
Subject: [PATCH] libkbdfile: Check compression suffix even if the suffix is
|
||||
part of filename
|
||||
|
||||
Link: https://github.com/legionus/kbd/issues/32
|
||||
|
||||
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
|
||||
---
|
||||
src/libkbdfile/kbdfile.c | 25 ++++++++++++-------------
|
||||
src/libkbdfile/kbdfile.h | 2 ++
|
||||
2 files changed, 14 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/libkbdfile/kbdfile.c b/src/libkbdfile/kbdfile.c
|
||||
index fb8e035..487b434 100644
|
||||
--- a/src/libkbdfile/kbdfile.c
|
||||
+++ b/src/libkbdfile/kbdfile.c
|
||||
@@ -344,20 +344,13 @@ StartScan:
|
||||
snprintf(fp->pathname, sizeof(fp->pathname), "%s/%s%s%s", dir, fnam, suf[index], (dc ? dc->ext : ""));
|
||||
|
||||
if (!dc) {
|
||||
- fp->flags &= ~KBDFILE_PIPE;
|
||||
- fp->fd = fopen(fp->pathname, "r");
|
||||
+ rc = maybe_pipe_open(fp);
|
||||
+ goto EndScan;
|
||||
+ }
|
||||
|
||||
- if (!(fp->fd)) {
|
||||
- strerror_r(errno, errbuf, sizeof(errbuf));
|
||||
- ERR(fp->ctx, "fopen: %s: %s", fp->pathname, errbuf);
|
||||
- rc = -1;
|
||||
- goto EndScan;
|
||||
- }
|
||||
- } else {
|
||||
- if (pipe_open(dc, fp) < 0) {
|
||||
- rc = -1;
|
||||
- goto EndScan;
|
||||
- }
|
||||
+ if (pipe_open(dc, fp) < 0) {
|
||||
+ rc = -1;
|
||||
+ goto EndScan;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -457,3 +450,9 @@ kbdfile_open(struct kbdfile_ctx *ctx, const char *filename)
|
||||
|
||||
return fp;
|
||||
}
|
||||
+
|
||||
+int
|
||||
+kbdfile_is_compressed(struct kbdfile *fp)
|
||||
+{
|
||||
+ return (fp->flags & KBDFILE_PIPE);
|
||||
+}
|
||||
diff --git a/src/libkbdfile/kbdfile.h b/src/libkbdfile/kbdfile.h
|
||||
index 412179a..0318a8e 100644
|
||||
--- a/src/libkbdfile/kbdfile.h
|
||||
+++ b/src/libkbdfile/kbdfile.h
|
||||
@@ -45,6 +45,8 @@ int kbdfile_set_pathname(struct kbdfile *fp, const char *pathname);
|
||||
FILE *kbdfile_get_file(struct kbdfile *fp);
|
||||
int kbdfile_set_file(struct kbdfile *fp, FILE *x);
|
||||
|
||||
+int kbdfile_is_compressed(struct kbdfile *fp);
|
||||
+
|
||||
#include <syslog.h>
|
||||
|
||||
void
|
25
temp/kbd/0002-libkeymap-dump-fix.patch
Normal file
25
temp/kbd/0002-libkeymap-dump-fix.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
From 8d0c1fe253c708cea09c18f225685dcee24a9ff0 Mon Sep 17 00:00:00 2001
|
||||
From: Daniele Debernardi <drebrez@gmail.com>
|
||||
Date: Fri, 13 Sep 2019 00:37:21 +0200
|
||||
Subject: [PATCH] libkeymap dump fix
|
||||
|
||||
---
|
||||
src/libkeymap/dump.c | 2 +-
|
||||
1 files changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/libkeymap/dump.c b/src/libkeymap/dump.c
|
||||
index 83ac351..10b307a 100644
|
||||
--- a/src/libkeymap/dump.c
|
||||
+++ b/src/libkeymap/dump.c
|
||||
@@ -72,7 +72,7 @@ int lk_dump_bkeymap(struct lk_ctx *ctx, FILE *fd)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < NR_KEYS / 2; j++) {
|
||||
- int v = lk_get_key(ctx, i, j);
|
||||
+ unsigned short v = lk_get_key(ctx, i, j);
|
||||
|
||||
if (fwrite(&v, sizeof(v), 1, fd) != 1)
|
||||
goto fail;
|
||||
--
|
||||
2.23.0
|
||||
|
187
temp/kbd/APKBUILD
Normal file
187
temp/kbd/APKBUILD
Normal file
|
@ -0,0 +1,187 @@
|
|||
# Forked from Alpine to fix keymap dump
|
||||
|
||||
pkgname=kbd
|
||||
pkgver=2.2.0
|
||||
pkgrel=2
|
||||
pkgdesc="Tools for configuring the console (keyboard, virtual terminals, etc.)"
|
||||
url="http://ftp.altlinux.org/pub/people/legion/kbd"
|
||||
arch="all"
|
||||
license="GPL-2.0-or-later"
|
||||
depends="kbd-misc"
|
||||
makedepends="linux-headers linux-pam-dev check-dev ckbcomp xkeyboard-config"
|
||||
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
|
||||
0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch
|
||||
0002-libkeymap-dump-fix.patch
|
||||
bkeymap.bin
|
||||
"
|
||||
|
||||
_datadir=/usr/share
|
||||
_xmapdir="$_datadir"/keymaps/xkb
|
||||
_bmapdir="$_datadir"/bkeymaps
|
||||
_badmaps="pk-ara"
|
||||
|
||||
prepare() {
|
||||
default_prepare
|
||||
|
||||
cd "$builddir"
|
||||
cp "$srcdir"/error.h .
|
||||
cp "$srcdir"/bkeymap.bin tests/data/dumpkeys-bkeymap
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "$builddir"
|
||||
./configure \
|
||||
--build=$CBUILD \
|
||||
--host=$CHOST \
|
||||
--disable-nls \
|
||||
--prefix=/usr \
|
||||
--datadir="$_datadir" \
|
||||
--htmldir=/usr/share/html/$pkgname
|
||||
make
|
||||
}
|
||||
|
||||
check() {
|
||||
# dumpkeys-bkeymap fails
|
||||
[ "$CARCH" = s390x ] && return 0
|
||||
cd "$builddir"
|
||||
make check
|
||||
}
|
||||
|
||||
_listxmaps() {
|
||||
local invariant line; invariant=false
|
||||
grep -v '^$' /usr/share/X11/xkb/rules/base.lst | while read line; do
|
||||
case "$line" in
|
||||
'! variant') invariant=true ;;
|
||||
'!'*) invariant=false ;;
|
||||
*) if $invariant; then
|
||||
echo "$line" | cut -d: -f1
|
||||
fi ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
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
|
||||
mv legacy "$pkgdir"/usr/share/keymaps
|
||||
|
||||
cd "$pkgdir"/usr/share/keymaps/legacy/i386
|
||||
# Make ISO-8815-9 maps the default, instead of 7-bit ones
|
||||
ln -s pt-latin9.map.gz qwerty/pt.map.gz
|
||||
mv azerty/fr.map.gz azerty/fr-old.map.gz
|
||||
ln -s fr-latin9.map.gz azerty/fr.map.gz
|
||||
|
||||
# Add some legacy aliases
|
||||
ln -s fr-latin9.map.gz azerty/fr-latin0.map.gz
|
||||
ln -s sv-latin1.map.gz qwerty/se-latin1.map.gz
|
||||
ln -s sr-cy.map.gz qwerty/sr-latin.map.gz
|
||||
|
||||
# Rename conflicting keymaps
|
||||
mv fgGIod/trf.map.gz fgGIod/trf-fgGIod.map.gz
|
||||
mv olpc/es.map.gz olpc/es-olpc.map.gz
|
||||
mv olpc/pt.map.gz olpc/pt-olpc.map.gz
|
||||
mv qwerty/cz.map.gz qwerty/cz-qwerty.map.gz
|
||||
|
||||
# Remove useless layouts
|
||||
rm -f i386/qwerty/ro_win.map.gz
|
||||
|
||||
cd "$builddir"
|
||||
|
||||
# Compile keymaps from X.org layouts
|
||||
mkdir -p "$pkgdir$_xmapdir"
|
||||
local layout variant
|
||||
_listxmaps | while read -r variant layout; do
|
||||
if ! test -f "$pkgdir$_xmapdir"/"$layout".map.gz; then
|
||||
echo "Generating keymap $layout..."
|
||||
ckbcomp "$layout" | gzip > "$pkgdir$_xmapdir"/"$layout".map.gz || exit 1
|
||||
fi
|
||||
echo "Generating keymap $layout-$variant..."
|
||||
ckbcomp "$layout" "$variant" | gzip > "$pkgdir$_xmapdir"/"$layout"-"$variant".map.gz || exit 1
|
||||
done
|
||||
|
||||
# Do some fix-ups on X.org keymaps
|
||||
mv "$pkgdir$_xmapdir"/fi.map.gz "$pkgdir$_xmapdir"/fi-kotoistus.map.gz
|
||||
|
||||
# Install html documentation
|
||||
mkdir -p "$pkgdir$_datadir"/html/$pkgname
|
||||
mv docs/doc/*.html "$pkgdir$_datadir"/html/$pkgname
|
||||
|
||||
# Replace busybox setfont utility.
|
||||
mkdir -p "$pkgdir"/usr/sbin
|
||||
mv "$pkgdir"/usr/bin/setfont "$pkgdir"/usr/sbin
|
||||
|
||||
# Link open to openvt
|
||||
ln -s openvt "$pkgdir"/usr/bin/open
|
||||
}
|
||||
|
||||
vlock() {
|
||||
pkgdesc="$pkgname vlock implemantation"
|
||||
depends=
|
||||
|
||||
# This is the only binary needing linux-pam so moving this to a
|
||||
# subpackage reduces the amount of depencies of the kbd package.
|
||||
|
||||
mkdir -p "$subpkgdir"/usr/bin
|
||||
mv "$pkgdir"/usr/bin/vlock "$subpkgdir"/usr/bin
|
||||
}
|
||||
|
||||
bkeymaps() {
|
||||
pkgdesc="X.org-derived binary keymaps"
|
||||
depends=
|
||||
replaces="bkeymaps"
|
||||
provides="bkeymaps"
|
||||
|
||||
mkdir -p "$subpkgdir$_bmapdir"
|
||||
local map variant layout; for map in "$pkgdir$_xmapdir"/*.map.gz; do
|
||||
variant="$(basename "$map" | cut -d. -f1)"
|
||||
case "$variant" in $_badmaps) continue ;; esac
|
||||
|
||||
layout="${variant%%-*}"
|
||||
mkdir -p "$subpkgdir$_bmapdir"/$layout
|
||||
echo "Generating binary keymap $variant..."
|
||||
"$pkgdir"/usr/bin/loadkeys -ub "$map" | gzip > "$subpkgdir$_bmapdir"/$layout/$variant.bmap.gz
|
||||
done
|
||||
}
|
||||
|
||||
legacy() {
|
||||
pkgdesc="kbd legacy keymaps"
|
||||
depends=
|
||||
|
||||
mkdir -p "$subpkgdir$_datadir"/keymaps
|
||||
mv "$pkgdir$_datadir"/keymaps/legacy "$subpkgdir$_datadir"/keymaps
|
||||
}
|
||||
|
||||
misc() {
|
||||
pkgdesc="kbd keymaps and console data"
|
||||
depends=
|
||||
|
||||
mkdir -p "$subpkgdir$_datadir"
|
||||
local dir; for dir in consolefonts consoletrans keymaps unimaps; do
|
||||
mv "$pkgdir$_datadir"/$dir "$subpkgdir$_datadir"
|
||||
done
|
||||
}
|
||||
|
||||
sha512sums="17f70402126e545c318a5de0265875135b6ebdc0ff9905cb8094dc74a5b27a9d6cede05f7dd4f6f1e68d4aff113e9c82b41caf4da5657d818b4d6a6d477a2789 kbd-2.2.0.tar.gz
|
||||
64b5ab4c362350521da8f507d22c0b77784da99bbe1b32f0c001cd826f63c607e3f9cd6af01f06a61af8bd709760bbf2bb3cfe2010c33925f2987a1af6ef4998 loadkeys.initd
|
||||
12028796552a5ffed1d5cb19d37fc6a73fb4f2e2bf34d837a81171c7ebee98d6c3f557715bf79706d79ce053b9b2450cd8cf1c4ea045428fb7d8a5915ae3ed78 loadkeys.confd
|
||||
c66f6b0d8c8b8d285c740bdbe7130dee272ac01cd5e73b35a58cedf1a77fe8d9e062631b804fb58014d8eb9861c8f28aed07bc022ef31662bcc61b5c85a21752 error.h
|
||||
bb67e5bb933a48f4a04402e07d7d67169a97485e6b469f8ccd4436466eb17ec2ddcf0ef74d22b3aae9e813feaee5bef0822ec50c384e0276a8c91f9325502a5f fix-tests.patch
|
||||
edd53405ae22c19c0c4384318fde7bdea27de5428931b304b1d1a02bc268aea147ec9ff2c7296f7f22ee1b544c6ba30688d77e85a3f8751d4c5bcbe80fd0e518 0001-libkbdfile-Check-compression-suffix-even-if-the-suff.patch
|
||||
45481fdbb185978f4cd1672d3e0f4d76affd84f01dd1c2be89a2c3182a983bd57b1b5cb0b23fa890b5f6e2d61d4239f5cdffc2878fe3268d56d43952e51c8b0e 0002-libkeymap-dump-fix.patch
|
||||
b22ddafcececec93d10d604702f8d54a25bf7c84fe435ca63c56950eebb081e6eb04a917da9735a4d1cb341849ddb854aefa573a2871efeb415bab01ba6fcdc9 bkeymap.bin"
|
BIN
temp/kbd/bkeymap.bin
Normal file
BIN
temp/kbd/bkeymap.bin
Normal file
Binary file not shown.
14
temp/kbd/bkeymaps.patch
Normal file
14
temp/kbd/bkeymaps.patch
Normal file
|
@ -0,0 +1,14 @@
|
|||
diff --git a/src/loadkeys.c b/src/loadkeys.c
|
||||
index 8b8e7a1..b3f7fea 100644
|
||||
--- a/src/loadkeys.c
|
||||
+++ b/src/loadkeys.c
|
||||
@@ -174,7 +174,8 @@ main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* get console */
|
||||
- fd = getfd(console);
|
||||
+ if (!(options & OPT_B))
|
||||
+ fd = getfd(console);
|
||||
|
||||
if (!(options & OPT_M) && !(options & OPT_B)) {
|
||||
/* check whether the keyboard is in Unicode mode */
|
20
temp/kbd/error.h
Normal file
20
temp/kbd/error.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef ERROR_H
|
||||
#define ERROR_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <err.h>
|
||||
|
||||
static inline void error(int status, int errnum, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
void (*errfunc[2])(int, const char *, va_list) = { &verr, &verrx };
|
||||
void (*warnfunc[2])(const char *, va_list) = { &vwarn, &vwarnx };
|
||||
fflush(stdout);
|
||||
va_start(ap, fmt);
|
||||
if (status != 0)
|
||||
errfunc[errnum==0](status, fmt, ap); /* does not return */
|
||||
warnfunc[errnum==0](fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
#endif
|
41
temp/kbd/fix-tests.patch
Normal file
41
temp/kbd/fix-tests.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
busybox readlink doesn't accept -e, and in these cases -f has the same effect.
|
||||
--- a/tests/alt-is-meta.in
|
||||
+++ b/tests/alt-is-meta.in
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh -efu
|
||||
|
||||
-cwd="$(readlink -ev "${0%/*}")"
|
||||
+cwd="$(readlink -fv "${0%/*}")"
|
||||
|
||||
cd "$cwd"
|
||||
|
||||
--- a/tests/dumpkeys-bkeymap.in
|
||||
+++ b/tests/dumpkeys-bkeymap.in
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh -efu
|
||||
|
||||
-cwd="$(readlink -ev "${0%/*}")"
|
||||
+cwd="$(readlink -fv "${0%/*}")"
|
||||
|
||||
cd "$cwd"
|
||||
|
||||
--- a/tests/dumpkeys-fulltable.in
|
||||
+++ b/tests/dumpkeys-fulltable.in
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh -efu
|
||||
|
||||
-cwd="$(readlink -ev "${0%/*}")"
|
||||
+cwd="$(readlink -fv "${0%/*}")"
|
||||
|
||||
cd "$cwd"
|
||||
|
||||
--- a/tests/dumpkeys-mktable.in
|
||||
+++ b/tests/dumpkeys-mktable.in
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh -efu
|
||||
|
||||
-cwd="$(readlink -ev "${0%/*}")"
|
||||
+cwd="$(readlink -fv "${0%/*}")"
|
||||
|
||||
cd "$cwd"
|
||||
|
23
temp/kbd/loadkeys.confd
Normal file
23
temp/kbd/loadkeys.confd
Normal file
|
@ -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"
|
72
temp/kbd/loadkeys.initd
Normal file
72
temp/kbd/loadkeys.initd
Normal file
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue