>Number:         162175
>Category:       bin
>Synopsis:       [patch] bsdinstall: add keymap selection loop and testing
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 30 20:20:09 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Warren Block
>Release:        FreeBSD-9
>Organization:
>Environment:
FreeBSD machine3.example.com 9.0-BETA3 FreeBSD 9.0-BETA3 #0: Sat Sep 24 
21:31:28 UTC 2011     r...@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC 
 amd64
>Description:
The existing bsdinstall keymap script gives the user one chance to choose the 
right keymap, and no way to test whether the one chosen matches the physical 
keyboard.

The patch modifies the keymap script to show the current keymap, test it, or 
pick a different one.  This option loops until the user selects "OK, use this 
keymap".
>How-To-Repeat:

>Fix:
Apply patch.

Patch attached with submission follows:

--- usr.sbin/bsdinstall/scripts/keymap.orig     2011-10-10 07:57:35.000000000 
-0600
+++ usr.sbin/bsdinstall/scripts/keymap  2011-10-23 07:30:15.000000000 -0600
@@ -26,10 +26,53 @@
 #
 # $FreeBSD: src/usr.sbin/bsdinstall/scripts/keymap,v 1.2.2.2 2011/10/10 
13:57:35 nwhitehorn Exp $
 
+: ${DIALOG_OK=0}
+: ${DIALOG_CANCEL=1}
+: ${DIALOG_EXTRA=3}
+: ${DIALOG_ESC=255}
+
+keymapfile="$BSDINSTALL_TMPETC/rc.conf.keymap"
+mapdescfile="/usr/share/syscons/keymaps/INDEX.keymaps"
+
 kbdcontrol -d >/dev/null 2>&1
 if [ $? -eq 0 ]; then
-       dialog --backtitle "FreeBSD Installer" --title "Keymap Selection" \
-           --yesno "Would you like to set a non-default key mapping for your 
keyboard?" 0 0 || exit 0
        exec 3>&1
-       kbdmap 2>&1 1>&3 | grep 'keymap=' > $BSDINSTALL_TMPETC/rc.conf.keymap
+       while : ; do
+               if [ -s "$keymapfile" ]; then
+                       keymap=`sed -e 's/keymap=\(.*\)/\1/' "$keymapfile"`
+                       mapdesc=`grep -m1 $keymap: $mapdescfile \
+                       | sed -e "s/$keymap:.*://"`
+               else
+                       mapdesc="default"
+               fi
+               
+               trap 'rm $keymapfile; exit 1' SIGINT
+               
+               dialog --backtitle "FreeBSD Installer" \
+                   --title "Keymap Selection" \
+                   --ok-label "OK, use this keymap" \
+                   --cancel-label "Pick different keymap" \
+                   --extra-button --extra-label "Test this keymap" \
+                   --yesno "The current keyboard mapping is:\n$mapdesc" 0 0
+               
+               case $? in
+               ${DIALOG_OK})
+                       break
+                       ;;
+               ${DIALOG_ESC})
+                       rm "$keymapfile"
+                       break
+                       ;;
+               ${DIALOG_CANCEL})
+                       kbdmap 2>&1 1>&3 \
+                       | grep 'keymap=' > "$keymapfile"
+                       ;;
+               ${DIALOG_EXTRA})
+                       keymaptest=`dialog --backtitle "FreeBSD Installer" \
+                           --title "Test keymap" \
+                           --no-cancel \
+                           --inputbox "Test the keymap by typing letters, 
numbers, and symbols.  Characters should match the labels on the keyboard 
keys.\nPress Enter to stop testing." 0 0 2>&1 1>&3`
+                       ;;
+               esac
+       done
 fi


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to