summaryrefslogtreecommitdiffstats
path: root/perl-install/keyboard.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/keyboard.pm')
-rw-r--r--perl-install/keyboard.pm28
1 files changed, 17 insertions, 11 deletions
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.
}