From 05e5865bdccd90c803eaa18a04d07ed6730b5f8e Mon Sep 17 00:00:00 2001
From: Roy Marples <roy@marples.name>
Date: Wed, 30 Jan 2008 16:36:18 +0000
Subject: Cleanup keymaps a little.

---
 init.d.Linux/keymaps | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

(limited to 'init.d.Linux/keymaps')

diff --git a/init.d.Linux/keymaps b/init.d.Linux/keymaps
index 5e21765a..fb7d9b2d 100755
--- a/init.d.Linux/keymaps
+++ b/init.d.Linux/keymaps
@@ -31,7 +31,6 @@ start()
 		return 1
 	fi
 
-	local loadkeys_uni= wkeys= 
 	local ttydev= n=
 	[ -d /dev/vc ] \
 		&& ttydev=/dev/vc/ \
@@ -42,17 +41,9 @@ start()
 		echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
 	fi
 
-	# Turn on unicode if user wants it
-	if yesno ${unicode}; then
-		n=1
-		while [ ${n} -le "${ttyn}" ]; do
-			kbd_mode -u -C "${ttydev}${n}"
-			n=$((${n} + 1))
-		done
-		loadkeys_uni="--unicode"
-	fi
-
 	ebegin "Loading key mappings"
+	local loadkeys_uni= wkeys= 
+	yesno ${unicode} && loadkeys_uni="--unicode"
 	yesno ${windowskeys} && wkeys="windowkeys"
 	loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps} 
 	eend $? "Error loading key mappings" || return $?
@@ -64,21 +55,20 @@ start()
 
 	# Set terminal encoding to either ASCII or UNICODE.
 	# See utf-8(7) for more information.
-	local termencoding= termmsg=
+	local termencoding="%@" termmsg="ASCII" kmode="-a"
 	if yesno ${unicode}; then
 		dumpkeys ${dumpkeys_charset:+-c} \
 			${dumpkeys_charset} | loadkeys --unicode
 		termencoding="%G"
 		termmsg="UTF-8"
-	else
-		termencoding="%@"
-		termmsg="ASCII"
+		kmode="-u"
 	fi
 
 	ebegin "Setting terminal encoding to" ${termmsg}
 	n=1
 	while [ ${n} -le "${ttyn}" ]; do
 		printf "\033%s" "${termencoding}" >"${ttydev}${n}"
+		kbd_mode "${kmode}" -C "${ttydev}${n}"
 		n=$((${n} + 1))
 	done
 	eend 0
-- 
cgit v1.2.3