diff options
author | Roy Marples <roy@marples.name> | 2007-11-23 22:23:20 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-11-23 22:23:20 +0000 |
commit | 206f7096e0b4c155b77a64b91990a5d8c91c9764 (patch) | |
tree | 36a939681543823bcdf2dfea77d2aeeb0484fbf3 /init.d.Linux/keymaps | |
parent | 168fa73a49553a90009b9077607593e9a5a77565 (diff) |
Fix var names
Diffstat (limited to 'init.d.Linux/keymaps')
-rwxr-xr-x | init.d.Linux/keymaps | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/init.d.Linux/keymaps b/init.d.Linux/keymaps index 8548a170..9b3ce03f 100755 --- a/init.d.Linux/keymaps +++ b/init.d.Linux/keymaps @@ -26,22 +26,18 @@ description="Applies a keymap for the consoles." +ttyn=${rc_tty_number:-${RC_TTY_NUMBER}:-12} +unicode=${unicode:-${UNICODE}} +keymap=${keymap:-${KEYMAP}} +extended_keymaps=${extended_keymaps:-${EXTENDED_KEYMAPS}} +windowskeys=${windowskeys:-${SET_WINDOWSKEYS}} +fix_euro=${fix_euro:-${FIX_EURO}} +dumpkeys_charset=${dumpkeys_charset:-${DUMPKEYS_CHARSET}} + depend() { need localmount } -checkconfig() { - if [ -z "${KEYMAP}" ] ; then - eerror "You need to setup KEYMAP in /etc/conf.d/keymaps first" - return 1 - fi - - # Make sure user isn't using rc.conf anymore - if grep -q "^KEYMAP=" /etc/rc.conf ; then - ewarn "KEYMAP should not be set in /etc/rc.conf but in /etc/conf.d/keymaps" - fi -} - start() { case "${RC_SYS}" in UML|VPS|XEN) @@ -51,37 +47,39 @@ start() { ;; esac - local WINDOWKEYS_KEYMAP= LOADKEYS_UNI= + if [ -z "${keymap}" ] ; then + eerror "You need to setup keymap in /etc/conf.d/keymaps first" + return 1 + fi + + local loadkeys_uni= wkeys= local ttydev= n= [ -d /dev/vc ] \ && ttydev=/dev/vc/ \ || ttydev=/dev/tty - checkconfig || return 1 - # Force linux keycodes for PPC. if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ] ; then echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes fi # Turn on unicode if user wants it - if [ "${UNICODE}" = "yes" ]; then + if yesno ${unicode}; then n=1 - while [ ${n} -le "${RC_TTY_NUMBER}" ]; do + while [ ${n} -le "${ttyn}" ]; do kbd_mode -u -C "${ttydev}${n}" n=$((${n} + 1)) done - LOADKEYS_UNI="--unicode" + loadkeys_uni="--unicode" fi ebegin "Loading key mappings" if [ -x /bin/loadkeys ] ; then - [ "${SET_WINDOWKEYS}" = "yes" ] && WINDOWKEYS_KEYMAP="windowkeys" - loadkeys -q ${LOADKEYS_UNI} ${WINDOWKEYS_KEYMAP} ${KEYMAP} \ - ${EXTENDED_KEYMAPS} + yesno ${windowskeys} && wkeys="windowkeys" + loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps} eend $? "Error loading key mappings" - if [ "${FIX_EURO}" = "yes" ] ; then + if yesno ${fix_euro}; then # Fix some fonts displaying the Euro, #173528. echo "altgr keycode 18 = U+20AC" | loadkeys -q fi @@ -93,11 +91,8 @@ start() { # Set terminal encoding to either ASCII or UNICODE. # See utf-8(7) for more information. local termencoding= termmsg= - if [ "${UNICODE}" = "yes" ] ; then - local dumpkey_opts= - [ -n "${DUMPKEYS_CHARSET}" ] && dumpkey_opts="-c ${DUMPKEYS_CHARSET}" - - dumpkeys ${dumpkey_opts} | loadkeys --unicode + if yesno ${unicode}; then + dumpkeys ${dumpkeys_charset:+-c} ${dumpkeys_charset} | loadkeys --unicode termencoding="%G" termmsg="UTF-8" else @@ -107,12 +102,11 @@ start() { ebegin "Setting terminal encoding to" ${termmsg} n=1 - while [ ${n} -le "${RC_TTY_NUMBER}" ] ; do + while [ ${n} -le "${ttyn}" ]; do printf "\033%s" "${termencoding}" >"${ttydev}${n}" n=$((${n} + 1)) done eend 0 } - # vim:ts=4 |