From 3454aef11964e13a3097158e0c398d02b0327559 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 29 Aug 2001 09:50:32 +0000 Subject: fix DISABLE_WINDOWS_KEY state handling (for upgrade), cleanup --- perl-install/keyboard.pm | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'perl-install/keyboard.pm') diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm index 066e32ea1..463fe41cc 100644 --- a/perl-install/keyboard.pm +++ b/perl-install/keyboard.pm @@ -228,8 +228,6 @@ arch() eq "ppc" ? ( )), ); -my $disable_windows_key = (detect_devices::isLaptop() ? "yes" : "no"); - #-###################################################################################### #- Functions #-###################################################################################### @@ -358,20 +356,28 @@ sub setup { sub write { my ($prefix, $keyboard, $charset, $isNotDelete) = @_; - setVarsInSh("$prefix/etc/sysconfig/keyboard", { KEYTABLE => keyboard2kmap($keyboard), - KBCHARSET => $charset, - REMOVE_MOD_META_L => "", - DISABLE_WINDOWS_KEY => $disable_windows_key, - BACKSPACE => $isNotDelete ? "BackSpace" : "Delete" }); + my $config = read_raw($prefix); + put_in_hash($config, { + KEYTABLE => keyboard2kmap($keyboard), + KBCHARSET => $charset, + }); + add2hash_($config, { + DISABLE_WINDOWS_KEY => bool2yesno(detect_devices::isLaptop()), + BACKSPACE => $isNotDelete ? "BackSpace" : "Delete", + }); + setVarsInSh("$prefix/etc/sysconfig/keyboard", %$config); run_program::rooted($prefix, "dumpkeys > /etc/sysconfig/console/default.kmap") or log::l("dumpkeys failed"); } +sub read_raw { + my ($prefix) = @_; + my %config = getVarsFromSh("$prefix/etc/sysconfig/keyboard"); + \%config; +} + sub read { my ($prefix) = @_; - my %keyf = getVarsFromSh("$prefix/etc/sysconfig/keyboard"); - my $keytable = $keyf{KEYTABLE}; - # If not yet defined in the file, check if we are a laptop: - $disable_windows_key = ($keyf{DISABLE_WINDOWS_KEY}) || (detect_devices::isLaptop() ? "yes" : "no"); + my $keytable = read_raw($prefix)->{KEYTABLE}; keyboard2kmap($_) eq $keytable and return $_ foreach keys %keyboards; $keyboards{$keytable} && $keytable; #- keep track of unknown keyboard. } -- cgit v1.2.1