Annotation of doc/loncapafiles/langcheck.piml, revision 1.3
1.1 golterma 1: <piml>
2: <targetroot>/</targetroot>
3: <files>
4: <file>
5: <target dist="default"></target>
6: <perlscript mode="fg">
7:
1.2 raeburn 8: if (open(PIPE,"locale |")) {
9: my @lines = <PIPE>;
10: close(PIPE);
11: print "Checking root bash language";
12: my ($is_english,$is_posix);
13: foreach my $line (@lines) {
14: if ($line =~ /^LANG=en/) {
15: $is_english = 1;
16: print "... OK\n";
17: last;
18: } elsif ($line =~ /^LANG=POSIX/) {
19: $is_posix = 1;
20: }
21: if ($is_posix) {
22: if ($line =~ /^LC_CTYPE=en/) {
23: $is_english = 1;
24: print "... OK\n";
25: last;
26: }
27: }
28: }
29: if (!$is_english) {
30: print "\n**** WARNING: You seem to have a non-English root bash. This can cause incorrect error messages.\n".
31: " It is recommended that you set your bash language to English by setting LANG=en_US.UTF-8 in /root/.bashrc\n";
32: }
1.1 golterma 33: }
34:
1.2 raeburn 35: my $osmsg = "\n**** WARNING: You seem to have a non-English operating system.\n";
36:
37: if ('<DIST />' eq 'sles9' || '<DIST />' eq 'sles10' || '<DIST />' eq 'sles11' ||
38: '<DIST />' eq 'suse11.1' || '<DIST />' eq 'suse11.2' || '<DIST />' eq 'suse11.3' ||
39: '<DIST />' eq 'suse11.4' || '<DIST />' eq '12.1') {
40: if (open(PIPE,"cat /etc/sysconfig/language |grep '^RC_LANG' |")) {
41: print "Checking OS language";
42: if (<PIPE> =~ /^RC_LANG="en/) {
43: print "... OK\n";
44: } else {
45: print $osmsg.
46: "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/sysconfig/language\n";
47: }
48: close(PIPE);
49: }
50: } elsif ('<DIST />' eq 'debian5' || '<DIST />' eq 'debian6' || '<DIST />' eq 'ubuntu6' ||
1.3 ! raeburn 51: '<DIST />' eq 'ubuntu8' || '<DIST />' eq 'ubuntu10' || '<DIST />' eq 'ubuntu12') {
1.2 raeburn 52: if (open(PIPE,"cat /etc/default/locale |grep '^LANG' |")) {
53: print "Checking OS language";
54: if (<PIPE> =~ /^LANG="en/) {
55: print "... OK\n";
56: } else {
57: print $osmsg.
58: "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/default/locale\n";
59: }
60: close(PIPE);
61: }
62: } else {
63: if (open(PIPE,"cat /etc/sysconfig/i18n |grep '^LANG' |")) {
64: print "Checking OS language";
65: if (<PIPE> =~ /^LANG="en/) {
66: print "... OK\n";
67: } else {
68: print $osmsg.
69: "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/sysconfig/i18n.\n";
70: }
71: close(PIPE);
1.1 golterma 72: }
73: }
74:
75: </perlscript>
76: </file>
77: </files>
1.2 raeburn 78: </piml>
79:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>