From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <s.ivanov@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id AAF73647AB
 for <pve-devel@lists.proxmox.com>; Mon, 20 Jul 2020 16:55:41 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 98A87F288
 for <pve-devel@lists.proxmox.com>; Mon, 20 Jul 2020 16:55:11 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 16D04F280
 for <pve-devel@lists.proxmox.com>; Mon, 20 Jul 2020 16:55:11 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id CF385431D9
 for <pve-devel@lists.proxmox.com>; Mon, 20 Jul 2020 16:55:10 +0200 (CEST)
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Mon, 20 Jul 2020 16:54:29 +0200
Message-Id: <20200720145429.18260-1-s.ivanov@proxmox.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH installer] set console keymap on language
 selection
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 20 Jul 2020 14:55:41 -0000

This is an enhancement for #2804

Having a shell waiting on vt3, it improves user experience if it has the
same keyboard map as the X11 installer.

This is accomplished by setting the contents of '/etc/default/keyboard' see
keyboard (5) and then running setupcon (1). Simply calling `loadkeys` would not
work, since the keymaps in debian are generated from the x11 definitions by
ckbcomp and then saved in '/etc/console-setup/'.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
roughly tested with a PBS-iso (can provide should someone else want to test it)
in a VM (clicking on french yielded azerty, clicking on german qwertz,...) both
worked. (just in case also tried getting rid of the setxkbmap call - setupcon
does not magically set the keyboard map of a running X session)
 proxinstall | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/proxinstall b/proxinstall
index 556c509..83ac95e 100755
--- a/proxinstall
+++ b/proxinstall
@@ -2668,8 +2668,19 @@ sub create_country_view {
 	if (my $kmap = $cmap->{kmaphash}->{$sel}) {
 	    my $xkmap = $cmap->{kmap}->{$kmap}->{x11};
 	    my $xvar = $cmap->{kmap}->{$kmap}->{x11var};
-	    syscmd ("setxkbmap $xkmap $xvar") if !$opt_testmode;
 	    $keymap = $kmap;
+
+	    if (! $opt_testmode) {
+		syscmd ("setxkbmap $xkmap $xvar");
+		my $kbd_config = qq{
+		    XKBLAYOUT="$xkmap"
+		    XKBVARIANT="$xvar"
+		    BACKSPACE="guess"
+		};
+		$kbd_config =~ s/^\t{2} {4}//;
+		write_config($kbd_config, '/etc/default/keyboard');
+		syscmd ("setupcon");
+	    }
 	}
     });
 
-- 
2.20.1