File:  [LON-CAPA] / doc / loncapafiles / langcheck.piml
Revision 1.1: download - view: text, annotated - select for diffs
Wed Nov 2 13:16:19 2011 UTC (12 years, 5 months ago) by goltermann
Branches: MAIN
CVS tags: HEAD
Added a language check for root bash and OS. Non-english languages can lead to incorrect warnings. Only tested with CentOS but it should work for other distros too.

<piml>
<targetroot>/</targetroot>
<files>
<file>
<target dist="default"></target>
<perlscript mode="fg">

print "Checking root bash language";
my $lang = `locale`;
if ($lang =~ "LANG=en") {
    print "... OK\n";
} else {
    print "\n**** WARNING: You seem to have a non-english root bash. This can cause incorrect error messages.\n".
        "    It is recommended to set your bash language to English.\n";   
}

my $file = "/etc/sysconfig/i18n";
if (open(my $IN,'<'.$file)) {
    print "Checking OS language";
    if (<$IN> =~ "LANG=\"en") {
        print "... OK\n";
    } else {
        print "\n**** WARNING: You seem to have a non-english operating system. ".
        "It is recommended to set the language in /etc/sysconfig/i18n to English.\n";
    }
}

</perlscript>
</file>
</files>
</piml>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>