From 1541218fe148cfae9c3a4ce84e7fd6692f3d2028 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Thu, 12 Apr 2007 21:56:32 +0200 Subject: Add support for loading keymaps. (closes: 337663) --- hooks/keymap | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 hooks/keymap (limited to 'hooks/keymap') 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 + -- cgit v1.2.3 From f26697d21e617646da61bed3c88e48be1d781cf5 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Mon, 27 Aug 2007 10:10:40 +0200 Subject: mkinitramfs, hooks/keymap: add trailing slash to cp destionation just make sure we really copy into a dir and not a file. --- debian/changelog | 3 ++- hooks/keymap | 2 +- mkinitramfs | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'hooks/keymap') diff --git a/debian/changelog b/debian/changelog index 1031a50..07bf916 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,8 +7,9 @@ initramfs-tools (0.91) UNRELEASED; urgency=low * mkinitramfs: Cope when no busybox is around warn on md/lvm root. * mkinitramfs: Kill kinit.shared too. * scripts/local: Quote readonly variable. (LP: #115807) + * mkinitramfs, scripts/keymap: Add trailing slash on cp destination for dir. - -- maximilian attems Sat, 25 Aug 2007 19:10:20 +0200 + -- maximilian attems Mon, 27 Aug 2007 10:09:25 +0200 initramfs-tools (0.90a) unstable; urgency=high diff --git a/hooks/keymap b/hooks/keymap index 749f24c..a2b1b08 100755 --- a/hooks/keymap +++ b/hooks/keymap @@ -27,7 +27,7 @@ fi . /usr/share/initramfs-tools/hook-functions copy_exec /bin/loadkeys /bin -cp /etc/console/boottime.kmap.gz ${DESTDIR}/etc +cp /etc/console/boottime.kmap.gz ${DESTDIR}/etc/ # Step 2 - Check for UTF8 console if [ ! -x /usr/bin/kbd_mode ]; then diff --git a/mkinitramfs b/mkinitramfs index 90a7702..4ba9cd4 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -219,13 +219,13 @@ for b in $(cd /usr/share/initramfs-tools/scripts/ && find . \ [ -d "${DESTDIR}/scripts/$(dirname "${b}")" ] \ || mkdir -p "${DESTDIR}/scripts/$(dirname "${b}")" cp -p "/usr/share/initramfs-tools/scripts/${b}" \ - "${DESTDIR}/scripts/$(dirname "${b}")" + "${DESTDIR}/scripts/$(dirname "${b}")/" done for b in $(cd "${CONFDIR}/scripts" && find . \ -regextype posix-extended -regex '.*/[[:alnum:]_]+$' -type f); do [ -d "${DESTDIR}/scripts/$(dirname "${b}")" ] \ || mkdir -p "${DESTDIR}/scripts/$(dirname "${b}")" - cp -p "${CONFDIR}/scripts/${b}" "${DESTDIR}/scripts/$(dirname "${b}")" + cp -p "${CONFDIR}/scripts/${b}" "${DESTDIR}/scripts/$(dirname "${b}")/" done echo "DPKG_ARCH=${DPKG_ARCH}" > ${DESTDIR}/conf/arch.conf @@ -264,11 +264,11 @@ copy_exec /sbin/modprobe /sbin copy_exec /sbin/depmod /sbin copy_exec /sbin/rmmod /sbin mkdir -p "${DESTDIR}/etc/modprobe.d" -cp -a /etc/modprobe.d/* "${DESTDIR}/etc/modprobe.d" +cp -a /etc/modprobe.d/* "${DESTDIR}/etc/modprobe.d/" # workaround: libgcc always needed on old-abi arm if [ "$DPKG_ARCH" = arm ] || [ "$DPKG_ARCH" = armeb ]; then - cp -a /lib/libgcc_s.so.1 "${DESTDIR}/lib" + cp -a /lib/libgcc_s.so.1 "${DESTDIR}/lib/" fi run_scripts /usr/share/initramfs-tools/hooks -- cgit v1.2.3 From 0830e97339add137d56d13cdbe07282f3cdba8f6 Mon Sep 17 00:00:00 2001 From: Maximilian Gass Date: Sat, 6 Feb 2010 21:01:14 +0100 Subject: mkinitramfs: KEYMAP option fails to work due to missing keymap I have attached a patch that makes the keymap hook consider /etc/console-setup/cached.kmap.gz. I have also added gunzip to the initramfs because otherwise loadkeys complained that it was missing and failed to load the keymap. (closes: #565416) Signed-off-by: maximilian attems --- hooks/keymap | 11 +++++++++-- hooks/klibc | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'hooks/keymap') diff --git a/hooks/keymap b/hooks/keymap index a2b1b08..fa97209 100755 --- a/hooks/keymap +++ b/hooks/keymap @@ -21,13 +21,20 @@ if [ "$KEYMAP" != "y" ] && [ "$KEYMAP" != "Y" ]; then fi # Step 1 - Basic tools -if [ ! -x /bin/loadkeys ] || [ ! -r /etc/console/boottime.kmap.gz ]; then +if [ ! -x /bin/loadkeys ] || +! ( [ -r /etc/console/boottime.kmap.gz ] \ + || [ -r /etc/console-setup/cached.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/ + +if [ -e /etc/console-setup/cached.kmap.gz ]; then + cp /etc/console-setup/cached.kmap.gz ${DESTDIR}/etc/boottime.kmap.gz +else + cp /etc/console/boottime.kmap.gz ${DESTDIR}/etc/ +fi # Step 2 - Check for UTF8 console if [ ! -x /usr/bin/kbd_mode ]; then diff --git a/hooks/klibc b/hooks/klibc index 56f49ef..663e22c 100755 --- a/hooks/klibc +++ b/hooks/klibc @@ -18,7 +18,7 @@ esac # klibc ln -s /usr/lib/klibc/bin/* ${DESTDIR}/bin ln -s /lib/klibc-*.so ${DESTDIR}/lib -rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip ${DESTDIR}/bin/zcat ${DESTDIR}/bin/gunzip +rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/gzip ${DESTDIR}/bin/zcat if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh fi -- cgit v1.2.3