diff options
author | Dave Reisner <d@falconindy.com> | 2011-06-13 21:13:08 +0200 |
---|---|---|
committer | Dave Reisner <d@falconindy.com> | 2011-06-19 23:33:34 +0200 |
commit | b0a3e03cbec5e552698e4dbfacee6ba16313a144 (patch) | |
tree | b4a9b36e76590a5b4dd92d8dab887a90681b8811 /install | |
parent | 77beaa3018f5cacf8bc51251b50e76041c7eb6cd (diff) | |
download | mkinitcpio-b0a3e03cbec5e552698e4dbfacee6ba16313a144.tar.gz mkinitcpio-b0a3e03cbec5e552698e4dbfacee6ba16313a144.tar.xz |
install/keymap: refactor and bashify
Write directly to the build root rather than creating temp files to be
added later on. Also cleanup syntax to Bash standards.
Signed-off-by: Dave Reisner <d@falconindy.com>
Diffstat (limited to 'install')
-rw-r--r-- | install/keymap | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/install/keymap b/install/keymap index 4038c87..cdc4da0 100644 --- a/install/keymap +++ b/install/keymap @@ -1,31 +1,24 @@ -# vim: set ft=sh: +#!/bin/bash -build() -{ - MODULES="" - BINARIES="" - FILES="" - SCRIPT="keymap" - eval "$(grep -e "^LOCALE=" -e "^KEYMAP=" /etc/rc.conf)" - if [ -n "$KEYMAP" ]; then - KEYMAP_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)" - UTF8_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)" - if [ -n "$(echo ${LOCALE} | grep -i utf)" ]; then - echo "UTF8='yes'" > ${UTF8_FILE} - /bin/loadkeys -q -u $KEYMAP -b > ${KEYMAP_FILE} +build() { + SCRIPT=keymap + + eval "$(grep -E "^(LOCALE|KEYMAP)=" /etc/rc.conf)" + if [[ $KEYMAP ]]; then + if [[ $LOCALE = *[Uu][Tt][Ff]-8 ]]; then + printf '%s\n' "UTF8=yes" > "$buildroot/keymap.utf8" + /bin/loadkeys -q -u $KEYMAP -b > "$buildroot/keymap.bin" else - echo "UTF8='no'" > ${UTF8_FILE} - /bin/loadkeys -q $KEYMAP -b > ${KEYMAP_FILE} + printf '%s\n' "UTF8=no" > "$buildroot/keymap.utf8" + /bin/loadkeys -q $KEYMAP -b > "$buildroot/keymap.bin" fi - add_file ${KEYMAP_FILE} /keymap.bin - add_file ${UTF8_FILE} /keymap.utf8 fi } -help () -{ -cat<<HELPEOF - This hook loads keymap(s) specified in rc.conf - during early userspace. +help() { + cat<<HELPEOF +This hook loads keymap(s) specified in rc.conf during early userspace. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: |