Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2006 14:19:52 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-qa@freebsd.org, Seth Kingsley <sethk@magnesium.net>
Subject:   Re: bin/93853: [PATCH]: Add country-specific keymap selection to sysinstall
Message-ID:  <200602281419.53871.jhb@freebsd.org>
In-Reply-To: <200602261910.k1QJAAmZ089790@freefall.freebsd.org>
References:  <200602261910.k1QJAAmZ089790@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sunday 26 February 2006 14:10, Seth Kingsley wrote:
> The following reply was made to PR bin/93853; it has been noted by GNATS.
> 
> From: Seth Kingsley <sethk@magnesium.net>
> To: K?vesd?n G?bor <gabor.kovesdan@t-hosting.hu>
> Cc: bug-followup@FreeBSD.org
> Subject: Re: bin/93853: [PATCH]: Add country-specific keymap selection to sysinstall
> Date: Sun, 26 Feb 2006 11:02:51 -0800
> 
>  On Sun, Feb 26, 2006 at 11:58:19AM +0100, K?vesd?n G?bor wrote:
>  > Great idea, I'd love to see it implemented. :)
>  > Could you possibly add Hungarian to the list, please?
>  
>  Hungary will work out of the box with this patch.  I've just tested it.  If
>  you're looking at the mappings from country to language in the diff, that's
>  only to handle cases where the keymap file is named after the language instead
>  of the 2-letter country code, such as "danish.iso", instead of "dk.iso".  All
>  240 countries listed in /usr/share/misc/iso3166 are included in the country
>  selection menu.

Hmm, I tried this out.  One thing I ran into just running it during multiuser
is that hitting Enter didn't work in the country selection dialog.  I had to
hit 'O' for Ok for some reason.  It works if I pick a non-default country
actually, so it's something in the logic for the default country case.  Hmm,
I fixed this by fixing dmenuSetCountryVariable() to return DITEM_SUCCESS
rather than void in the DEFAULT_COUNTRY case.  That's really odd that it
didn't flag that as a warning.  Also, I fixed keymapMenuSelect() to correctly
return a DITEM_* value if VAR_COUNTRY wasn't set (dmenuOpenSimple returns a
boolean).  Finally, I think that this should only popup during installs and
if it is run as non-init it shouldn't pop this menu up (under the assumption
that in multiuser you've already set the keymap).

Updated portions of the diff look like:

@@ -111,6 +112,21 @@
 }

 int
+dmenuSetCountryVariable(dialogMenuItem *tmp)
+{
+    variable_set((char *)tmp->data, FALSE);
+#ifdef WITH_SYSCONS
+    /* Don't prompt the user for a keymap if they're using the default locale.
*/
+    if (!strcmp(variable_get(VAR_COUNTRY), DEFAULT_COUNTRY))
+       return DITEM_SUCCESS;
+
+    return keymapMenuSelect(tmp);
+#else
+    return DITEM_SUCCESS;
+#endif
+}

...

+    if ((country = variable_get(VAR_COUNTRY)) != NULL)
+    {
+       lang = country;
+       for (i = 0; map[i].country; ++i)
+           if (!strcmp(country, map[i].country))
+           {
+               lang = map[i].lang;
+               break;
+           }
+

(simplified logic that defaults lang to country)

...

+    }
+    else
+       return dmenuOpenSimple(&MenuSysconsKeymap, FALSE) ? DITEM_SUCCESS :
+           DITEM_FAILURE;
+}
+

...

@@ -158,6 +158,10 @@
        systemShutdown(status);
     }

+    /* Get user's country and keymap */
+    if (RunningAsInit)
+       configCountry(NULL);
+
     /* Begin user dialog at outer menu */
     dialog_clear();
     while (1) {

Does this sound ok?

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602281419.53871.jhb>