diff options
| author | David Härdeman <david@austin.(none)> | 2007-04-12 21:56:32 +0200 |
|---|---|---|
| committer | David Härdeman <david@austin.(none)> | 2007-04-12 21:56:32 +0200 |
| commit | 1541218fe148cfae9c3a4ce84e7fd6692f3d2028 (patch) | |
| tree | 94ed1a69e1aea03c37cfde1237c64a54e00e3469 | |
| parent | fdbdb7193427633c6ac8574f5416058b3b70e305 (diff) | |
| download | initramfs-tools-1541218fe148cfae9c3a4ce84e7fd6692f3d2028.tar.gz initramfs-tools-1541218fe148cfae9c3a4ce84e7fd6692f3d2028.zip | |
Add support for loading keymaps. (closes: 337663)
| -rw-r--r-- | conf/initramfs.conf | 9 | ||||
| -rw-r--r-- | debian/changelog | 6 | ||||
| -rwxr-xr-x | hooks/keymap | 55 | ||||
| -rw-r--r-- | initramfs.conf.5 | 7 | ||||
| -rwxr-xr-x | mkinitramfs | 1 | ||||
| -rwxr-xr-x | scripts/init-top/keymap | 27 |
6 files changed, 104 insertions, 1 deletions
diff --git a/conf/initramfs.conf b/conf/initramfs.conf index b0d1dc0..0620d26 100644 --- a/conf/initramfs.conf +++ b/conf/initramfs.conf @@ -17,6 +17,7 @@ MODULES=most +# # BUSYBOX: [ y | n ] # # Use busybox if available. @@ -25,6 +26,14 @@ MODULES=most BUSYBOX=y # +# KEYMAP: [ y | n ] +# +# Load a keymap during the initramfs stage. +# + +KEYMAP=n + +# # NFS Section of the config. # diff --git a/debian/changelog b/debian/changelog index 0da1fed..f224405 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/hooks/keymap b/hooks/keymap new file mode 100755 index 0000000..749f24c --- /dev/null +++ b/hooks/keymap @@ -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 + diff --git a/initramfs.conf.5 b/initramfs.conf.5 index e685298..55d6629 100644 --- a/initramfs.conf.5 +++ b/initramfs.conf.5 @@ -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 diff --git a/mkinitramfs b/mkinitramfs index 17e1846..7d73ba1 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -163,6 +163,7 @@ export CONFDIR export DESTDIR export DPKG_ARCH export verbose +export KEYMAP # Private, used by 'catenate_cpiogz'. export __TMPCPIOGZ diff --git a/scripts/init-top/keymap b/scripts/init-top/keymap new file mode 100755 index 0000000..f011abf --- /dev/null +++ b/scripts/init-top/keymap @@ -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 |
