Add support for loading keymaps. (closes: 337663)

This commit is contained in:
David Härdeman 2007-04-12 21:56:32 +02:00
parent fdbdb71934
commit 1541218fe1
6 changed files with 104 additions and 1 deletions

View File

@ -17,6 +17,7 @@
MODULES=most
#
# BUSYBOX: [ y | n ]
#
# Use busybox if available.
@ -24,6 +25,14 @@ MODULES=most
BUSYBOX=y
#
# KEYMAP: [ y | n ]
#
# Load a keymap during the initramfs stage.
#
KEYMAP=n
#
# NFS Section of the config.
#

6
debian/changelog vendored
View File

@ -1,10 +1,14 @@
initramfs-tools (0.87) UNRELEASED; urgency=low
[ maximilian attems ]
* scripts/functions: reduce_satisfied() needs to ignore the same set as
set_initlist() otherwise an script having a prereqs on a non-executable
boot script may cause circular panic. (closes: 418509)
-- maximilian attems <maks@debian.org> Wed, 11 Apr 2007 00:07:18 +0200
[ David Härdeman ]
* Add support for loading keymaps. (closes: 337663)
-- David Härdeman <david@hardeman.nu> Thu, 12 Apr 2007 21:28:45 +0200
initramfs-tools (0.86) unstable; urgency=low

55
hooks/keymap Executable file
View File

@ -0,0 +1,55 @@
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
# Hook to load keymaps into the initramfs if requested by KEYMAP="y"
if [ "$KEYMAP" != "y" ] && [ "$KEYMAP" != "Y" ]; then
exit 0
fi
# Step 1 - Basic tools
if [ ! -x /bin/loadkeys ] || [ ! -r /etc/console/boottime.kmap.gz ]; then
exit 0
fi
. /usr/share/initramfs-tools/hook-functions
copy_exec /bin/loadkeys /bin
cp /etc/console/boottime.kmap.gz ${DESTDIR}/etc
# Step 2 - Check for UTF8 console
if [ ! -x /usr/bin/kbd_mode ]; then
exit 0
fi
if [ -r /etc/environment ]; then
env="/etc/environment"
elif [ -r /etc/default/locale ]; then
env="/etc/default/locale"
else
exit 0
fi
for var in LANG LC_ALL LC_CTYPE; do
value=$(egrep "^[^#]*${var}=" $env | tail -n1 | cut -d= -f2)
eval $var=$value
done
charmap=$(LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap)
if [ "$charmap" = "UTF-8" ]; then
copy_exec /usr/bin/kbd_mode /bin
fi
exit 0

View File

@ -40,6 +40,13 @@ If set to 'n'
will build an initramfs without busybox.
Beware that many boot scripts need busybox utilities.
.TP
\fB KEYMAP
If set to 'y', the console keymap will be loaded during the initramfs stage.
The keymap will anyway be loaded by the initscripts later, and the packages
that might need input will normally set this variable automatically, so there
should normally be no need to set this.
.SH NFS VARIABLES
.TP
\fB BOOT

View File

@ -163,6 +163,7 @@ export CONFDIR
export DESTDIR
export DPKG_ARCH
export verbose
export KEYMAP
# Private, used by 'catenate_cpiogz'.
export __TMPCPIOGZ

27
scripts/init-top/keymap Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
PREREQ=""
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
OPTS="-q"
# Should terminal be in UTF8 mode?
if [ -x /bin/kbd_mode ]; then
/bin/kbd_mode -u
OPTS="${OPTS} -u"
fi
# Load custom keymap
if [ -x /bin/loadkeys -a -r /etc/boottime.kmap.gz ]; then
loadkeys ${OPTS} /etc/boottime.kmap.gz
fi