Annotation of doc/loncapafiles/langcheck.piml, revision 1.29
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:
1.8 raeburn 37: if ('<DIST />' eq 'sles9' || '<DIST />' eq 'sles10' || '<DIST />' eq 'sles11' || '<DIST />' eq 'sles12' ||
1.2 raeburn 38: '<DIST />' eq 'suse11.1' || '<DIST />' eq 'suse11.2' || '<DIST />' eq 'suse11.3' ||
1.4 raeburn 39: '<DIST />' eq 'suse11.4' || '<DIST />' eq 'suse12.1' || '<DIST />' eq 'suse12.2' ||
1.8 raeburn 40: '<DIST />' eq 'suse12.3' || '<DIST />' eq 'suse13.1' || '<DIST />' eq 'suse13.2') {
1.2 raeburn 41: if (open(PIPE,"cat /etc/sysconfig/language |grep '^RC_LANG' |")) {
42: print "Checking OS language";
43: if (<PIPE> =~ /^RC_LANG="en/) {
44: print "... OK\n";
45: } else {
46: print $osmsg.
47: "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/sysconfig/language\n";
48: }
49: close(PIPE);
50: }
51: } elsif ('<DIST />' eq 'debian5' || '<DIST />' eq 'debian6' || '<DIST />' eq 'ubuntu6' ||
1.6 raeburn 52: '<DIST />' eq 'ubuntu8' || '<DIST />' eq 'ubuntu10' || '<DIST />' eq 'ubuntu12' ||
1.21 raeburn 53: '<DIST />' eq 'ubuntu14' || '<DIST />' eq 'ubuntu16' || '<DIST />' eq 'ubuntu18' ||
54: '<DIST />' eq 'ubuntu20') {
1.2 raeburn 55: if (open(PIPE,"cat /etc/default/locale |grep '^LANG' |")) {
56: print "Checking OS language";
1.29 ! raeburn 57: if (<PIPE> =~ /^LANG=en/) {
1.2 raeburn 58: print "... OK\n";
59: } else {
60: print $osmsg.
1.29 ! raeburn 61: "It is recommended that you set LANG=en_US.UTF-8 in /etc/default/locale\n";
1.2 raeburn 62: }
63: close(PIPE);
64: }
1.7 raeburn 65: } elsif ('<DIST />' eq 'fedora18' || '<DIST />' eq 'fedora19' || '<DIST />' eq 'fedora20' ||
1.12 raeburn 66: '<DIST />' eq 'fedora21' || '<DIST />' eq 'fedora22' || '<DIST />' eq 'fedora23' ||
1.13 raeburn 67: '<DIST />' eq 'fedora24' || '<DIST />' eq 'fedora25' || '<DIST />' eq 'fedora26' ||
1.15 raeburn 68: '<DIST />' eq 'fedora27' || '<DIST />' eq 'fedora28' || '<DIST />' eq 'fedora29' ||
1.23 raeburn 69: '<DIST />' eq 'fedora30' || '<DIST />' eq 'fedora31' || '<DIST />' eq 'fedora32' ||
1.26 raeburn 70: '<DIST />' eq 'fedora33' || '<DIST />' eq 'fedora34' || '<DIST />' eq 'fedora35' ||
71: '<DIST />' eq 'rhes7' || '<DIST />' eq 'centos7' || '<DIST />' eq 'scientific7' ||
72: '<DIST />' eq 'rhes8' || '<DIST />' eq 'centos8' || '<DIST />' eq 'oracle7' ||
1.28 raeburn 73: '<DIST />' eq 'oracle8' || '<DIST />' eq 'rocky8' || '<DIST />' eq 'alma8' ||
74: '<DIST />' eq 'centos8-stream' || '<DIST />' eq 'centos9-stream') {
1.5 raeburn 75: if (open(PIPE,"cat /etc/locale.conf |grep '^LANG' |")) {
76: print "Checking OS language";
77: if (<PIPE> =~ /^LANG="en/) {
78: print "... OK\n";
79: } else {
80: print $osmsg.
81: "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/locale.conf\n";
82: }
83: close(PIPE);
1.10 raeburn 84: }
1.15 raeburn 85: } elsif ('<DIST />' eq 'sles15') {
86: if (open(PIPE,"cat /etc/locale.conf |grep '^LANG' |")) {
87: print "Checking OS language";
88: if (<PIPE> =~ /^LANG=en/) {
89: print "... OK\n";
90: } else {
91: print $osmsg.
92: "It is recommended that you set LANG=en_US.UTF-8 in /etc/locale.conf\n";
93: }
94: close(PIPE);
95: }
1.2 raeburn 96: } else {
97: if (open(PIPE,"cat /etc/sysconfig/i18n |grep '^LANG' |")) {
98: print "Checking OS language";
99: if (<PIPE> =~ /^LANG="en/) {
100: print "... OK\n";
101: } else {
102: print $osmsg.
103: "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/sysconfig/i18n.\n";
104: }
105: close(PIPE);
1.1 golterma 106: }
107: }
108:
109: </perlscript>
110: </file>
111: </files>
1.2 raeburn 112: </piml>
113:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>