2
# This script configures XFree86 for LTSP in skolelinux.
7
require '/usr/lib/localization-config/sarge/xfree86-kbd';
10
my @f = split(m%/%, $0); pop @f;
11
push @INC, join("/", @f);
14
my %lang_map = get_lang_map();
18
my $LTS_CONF = "/opt/ltsp/i386/etc/lts.conf";
20
# If no locale is given as argument, quit
21
my $lang = $ARGV[0] or die "No language given";
23
# Print the supported locale entries.
24
if ("supported" eq $lang) {
25
for $lang (sort keys %lang_map) {
31
if ( ! -f $LTS_CONF ) {
32
print STDERR "warning: ltsp-xfree86-kbd: Doing nothing, lts.conf is missing.\n" if $debug;
36
# Udate lts.conf, replacing "XkbLayout" line.
37
if(defined(my $conf = $lang_map{$lang})) {
38
my $layout = $conf->{'LAYOUT'};
39
my $options = $conf->{'XKBOPTIONS'};
40
open(CFG, "< $LTS_CONF") || die "Unable to read $LTS_CONF";
44
@lines = map { if (m/^(\s*XkbLayout\s*=\s*)(.+)$/)
48
# the following is disabled for now, since LTSP 3.0 does not
49
# support this option.
50
# @lines = map { if (m/^(\s*XkbOptions\s*=\s*)(.+)$/)
51
# { "\"$1$options\""; }
54
open(CFG, "> $LTS_CONF.new") || die "Unable to write $LTS_CONF.new.";
55
print CFG join("\n",@lines, "") || die "Unable to write to $LTS_CONF.new.";
56
close(CFG) || die "Unable to close $LTS_CONF.new.";
57
rename("$LTS_CONF.new", $LTS_CONF) ||
58
die "Unable to rename $LTS_CONF.new to $LTS_CONF.";
60
die "$0: No support for language '$lang'\n";