summaryrefslogtreecommitdiffstats
path: root/examples/minimal/files/set-lang-kbd
blob: bcec6470566742afdc6a70c8a3d62c8106895e42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

use lib qw(/usr/lib/libDrakX);

use common;
use do_pkgs;
use lang;
use keyboard;

my $do_pkgs = do_pkgs::do_pkgs;

my $locale = lang::read();
my ($lang) = cat_("/proc/cmdline") =~ /\blang=(\w+?)\b/;
my $h = lang::lang_to_ourlocale($lang);
if ($lang && member($h->{lang}, lang::list_langs(exclude_non_installed => 1))) {
    put_in_hash($locale, $h);
    lang::set($locale);
}
lang::write_and_install($locale, $do_pkgs);

my $keyboard = $locale ? keyboard::lang2keyboard($locale->{lang}) : keyboard::read_or_default();
my ($kbd) = cat_("/proc/cmdline") =~ /\bkbd=(\w+?)\b/;
$keyboard->{KEYBOARD} = $kbd if $kbd;
keyboard::configure_and_set_standalone($keyboard);