public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer] set console keymap on language selection
@ 2020-07-20 14:54 Stoiko Ivanov
  2020-07-20 16:00 ` Thomas Lamprecht
  0 siblings, 1 reply; 3+ messages in thread
From: Stoiko Ivanov @ 2020-07-20 14:54 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH installer] set console keymap on language selection
  2020-07-20 14:54 [pve-devel] [PATCH installer] set console keymap on language selection Stoiko Ivanov
@ 2020-07-20 16:00 ` Thomas Lamprecht
  2020-07-20 16:02   ` Stoiko Ivanov
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Lamprecht @ 2020-07-20 16:00 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stoiko Ivanov

On 20.07.20 16:54, Stoiko Ivanov wrote:
> 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}//;

pretty fragile, a indentation change breaks this... why not s/^\s+//;

> +		write_config($kbd_config, '/etc/default/keyboard');
> +		syscmd ("setupcon");
> +	    }
>  	}
>      });
>  
> 





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH installer] set console keymap on language selection
  2020-07-20 16:00 ` Thomas Lamprecht
@ 2020-07-20 16:02   ` Stoiko Ivanov
  0 siblings, 0 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2020-07-20 16:02 UTC (permalink / raw)
  To: Thomas Lamprecht; +Cc: Proxmox VE development discussion

On Mon, 20 Jul 2020 18:00:25 +0200
Thomas Lamprecht <t.lamprecht@proxmox.com> wrote:

> On 20.07.20 16:54, Stoiko Ivanov wrote:
> > 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}//;  
> 
> pretty fragile, a indentation change breaks this... why not s/^\s+//;
sounds much better - will send a v2
thanks!

> 
> > +		write_config($kbd_config, '/etc/default/keyboard');
> > +		syscmd ("setupcon");
> > +	    }
> >  	}
> >      });
> >  
> >   
> 





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-20 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 14:54 [pve-devel] [PATCH installer] set console keymap on language selection Stoiko Ivanov
2020-07-20 16:00 ` Thomas Lamprecht
2020-07-20 16:02   ` Stoiko Ivanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal