From owner-freebsd-bugs@FreeBSD.ORG Sun Oct 30 20:20:09 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BA311065672 for ; Sun, 30 Oct 2011 20:20:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 69ABB8FC0C for ; Sun, 30 Oct 2011 20:20:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p9UKK9xS094114 for ; Sun, 30 Oct 2011 20:20:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p9UKK9r8094113; Sun, 30 Oct 2011 20:20:09 GMT (envelope-from gnats) Resent-Date: Sun, 30 Oct 2011 20:20:09 GMT Resent-Message-Id: <201110302020.p9UKK9r8094113@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Warren Block Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F35DD106566C for ; Sun, 30 Oct 2011 20:13:54 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id CA5D18FC1C for ; Sun, 30 Oct 2011 20:13:54 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p9UKDsbL057288 for ; Sun, 30 Oct 2011 20:13:54 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p9UKDs3B057284; Sun, 30 Oct 2011 20:13:54 GMT (envelope-from nobody) Message-Id: <201110302013.p9UKDs3B057284@red.freebsd.org> Date: Sun, 30 Oct 2011 20:13:54 GMT From: Warren Block To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/162175: [patch] bsdinstall: add keymap selection loop and testing X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Oct 2011 20:20:09 -0000 >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 root@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: