e-smith-base/root/etc/e-smith/db/configuration/migrate/05sysconfig

39 lines
781 B
Plaintext
Raw Permalink Normal View History

{
open F, "/etc/locale.conf";
my ($line) = grep(/^LANG/, <F>);
close F;
my $lang = ($line =~ /^LANG="?([a-zA-Z0-9_.-]*)"?/) ? $1 : "en_US.UTF-8";
my $kbdtype = "pc";
my $keytable = "us";
if (open F, "/etc/X11/xorg.conf.d/00-keyboard.conf")
{
my @lines = <F>;
close F;
#($line) = grep(/^KEYBOARDTYPE/, @lines);
#if ($line =~ /^KEYBOARDTYPE="(.*)"/)
#{
# $kbdtype = $1;
#}
($line) = grep(/^\s+Option "XkbLayout"/, @lines);
if ($line =~ /^\s+Option "XkbLayout"\s+"(.*)"/)
{
$keytable = $1;
}
}
my $sysconfig = $DB->get('sysconfig') ||
$DB->new_record('sysconfig',
{ type => 'configuration'}
);
$sysconfig->merge_props(
Language => $lang,
KeyboardType => $kbdtype,
Keytable => $keytable,
);
}