blob: 8c01ffb21940f4c88ee697a27899bf4af5471180 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/bin/bash
get_decompressor() {
case "$1" in
*.gz)
cat=zcat
of=${1%.gz}
;;
*.bz2)
cat=bzcat
of=${1%.bz2}
;;
*)
cat=cat
of=$1
;;
esac
}
add_keymap_file() {
local cat cmd rest f of
while read f; do
get_decompressor "$f"
while read -r cmd rest; do
if [[ $cmd == include ]]; then
eval set $rest
add_keymap_file "$1"
fi
done < <($cat "$f")
add_dir "${of%/*}"
$cat "$f" > "$BUILDROOT/$of"
done < <(find /usr/share/kbd/keymaps/ -type f -regex ".*/$1\(\.inc\)?\(\.gz\|\.bz2\)?")
}
build() {
add_binary /usr/lib/systemd/systemd-vconsole-setup
add_binary loadkeys
add_binary setfont
add_file /etc/vconsole.conf
add_udev_rule 90-vconsole.rules
# subshell to avoid namespace pollution
(
shopt -s nullglob
[[ -s /etc/vconsole.conf ]] && . /etc/vconsole.conf
[[ $KEYMAP ]] && add_keymap_file $KEYMAP.map
[[ $KEYMAP_TOGGLE ]] && add_keymap_file $KEYMAP_TOGGLE.map
if [[ $FONT ]]; then
for file in "/usr/share/kbd/consolefonts/$FONT".@(fnt|psf?(u))?(.gz); do
get_decompressor "$file"
add_dir "${of%/*}"
$cat "$file" > "$BUILDROOT/$of"
done
fi
)
}
help() {
cat <<HELPEOF
This hook adds the keymap(s) and font specified in vconsole.conf to the image and
loads them during early userspace.
HELPEOF
}
# vim: set ft=sh ts=4 sw=4 et:
|