Annotation of doc/loncapafiles/langcheck.piml, revision 1.37
1.33 raeburn 1: <!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN"
2: "http://lpml.sourceforge.net/DTD/piml.dtd">
3: <!-- langcheck.piml -->
4:
1.37 ! raeburn 5: <!-- $Id: langcheck.piml,v 1.36 2024/06/13 12:57:13 raeburn Exp $ -->
1.33 raeburn 6:
7: <!--
8:
9: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
10:
11: LON-CAPA is free software; you can redistribute it and/or modify
12: it under the terms of the GNU General Public License as published by
13: the Free Software Foundation; either version 2 of the License, or
14: (at your option) any later version.
15:
16: LON-CAPA is distributed in the hope that it will be useful,
17: but WITHOUT ANY WARRANTY; without even the implied warranty of
18: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19: GNU General Public License for more details.
20:
21: You should have received a copy of the GNU General Public License
22: along with LON-CAPA; if not, write to the Free Software
23: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24:
25: /home/httpd/html/adm/gpl.txt
26:
27: http://www.lon-capa.org/
28:
29: -->
1.1 golterma 30: <piml>
31: <targetroot>/</targetroot>
32: <files>
33: <file>
34: <target dist="default"></target>
35: <perlscript mode="fg">
36:
1.2 raeburn 37: if (open(PIPE,"locale |")) {
38: my @lines = <PIPE>;
39: close(PIPE);
40: print "Checking root bash language";
41: my ($is_english,$is_posix);
42: foreach my $line (@lines) {
43: if ($line =~ /^LANG=en/) {
44: $is_english = 1;
45: print "... OK\n";
46: last;
47: } elsif ($line =~ /^LANG=POSIX/) {
48: $is_posix = 1;
49: }
50: if ($is_posix) {
51: if ($line =~ /^LC_CTYPE=en/) {
52: $is_english = 1;
53: print "... OK\n";
54: last;
55: }
56: }
57: }
58: if (!$is_english) {
59: print "\n**** WARNING: You seem to have a non-English root bash. This can cause incorrect error messages.\n".
60: " It is recommended that you set your bash language to English by setting LANG=en_US.UTF-8 in /root/.bashrc\n";
61: }
1.1 golterma 62: }
63:
1.2 raeburn 64: my $osmsg = "\n**** WARNING: You seem to have a non-English operating system.\n";
65:
1.8 raeburn 66: if ('<DIST />' eq 'sles9' || '<DIST />' eq 'sles10' || '<DIST />' eq 'sles11' || '<DIST />' eq 'sles12' ||
1.2 raeburn 67: '<DIST />' eq 'suse11.1' || '<DIST />' eq 'suse11.2' || '<DIST />' eq 'suse11.3' ||
1.4 raeburn 68: '<DIST />' eq 'suse11.4' || '<DIST />' eq 'suse12.1' || '<DIST />' eq 'suse12.2' ||
1.8 raeburn 69: '<DIST />' eq 'suse12.3' || '<DIST />' eq 'suse13.1' || '<DIST />' eq 'suse13.2') {
1.2 raeburn 70: if (open(PIPE,"cat /etc/sysconfig/language |grep '^RC_LANG' |")) {
71: print "Checking OS language";
72: if (<PIPE> =~ /^RC_LANG="en/) {
73: print "... OK\n";
74: } else {
75: print $osmsg.
76: "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/sysconfig/language\n";
77: }
78: close(PIPE);
79: }
80: } elsif ('<DIST />' eq 'debian5' || '<DIST />' eq 'debian6' || '<DIST />' eq 'ubuntu6' ||
1.6 raeburn 81: '<DIST />' eq 'ubuntu8' || '<DIST />' eq 'ubuntu10' || '<DIST />' eq 'ubuntu12' ||
1.21 raeburn 82: '<DIST />' eq 'ubuntu14' || '<DIST />' eq 'ubuntu16' || '<DIST />' eq 'ubuntu18' ||
1.36 raeburn 83: '<DIST />' eq 'ubuntu20' || '<DIST />' eq 'ubuntu22' || '<DIST />' eq 'ubuntu24' ||
1.37 ! raeburn 84: '<DIST />' eq 'debian10' || '<DIST />' eq 'debian11' || '<DIST />' eq 'debian12') {
1.2 raeburn 85: if (open(PIPE,"cat /etc/default/locale |grep '^LANG' |")) {
86: print "Checking OS language";
1.29 raeburn 87: if (<PIPE> =~ /^LANG=en/) {
1.2 raeburn 88: print "... OK\n";
89: } else {
90: print $osmsg.
1.29 raeburn 91: "It is recommended that you set LANG=en_US.UTF-8 in /etc/default/locale\n";
1.2 raeburn 92: }
93: close(PIPE);
94: }
1.7 raeburn 95: } elsif ('<DIST />' eq 'fedora18' || '<DIST />' eq 'fedora19' || '<DIST />' eq 'fedora20' ||
1.12 raeburn 96: '<DIST />' eq 'fedora21' || '<DIST />' eq 'fedora22' || '<DIST />' eq 'fedora23' ||
1.13 raeburn 97: '<DIST />' eq 'fedora24' || '<DIST />' eq 'fedora25' || '<DIST />' eq 'fedora26' ||
1.15 raeburn 98: '<DIST />' eq 'fedora27' || '<DIST />' eq 'fedora28' || '<DIST />' eq 'fedora29' ||
1.23 raeburn 99: '<DIST />' eq 'fedora30' || '<DIST />' eq 'fedora31' || '<DIST />' eq 'fedora32' ||
1.26 raeburn 100: '<DIST />' eq 'fedora33' || '<DIST />' eq 'fedora34' || '<DIST />' eq 'fedora35' ||
1.32 raeburn 101: '<DIST />' eq 'fedora36' || '<DIST />' eq 'fedora37' || '<DIST />' eq 'fedora38' ||
1.35 raeburn 102: '<DIST />' eq 'fedora39' || '<DIST />' eq 'fedora40' || '<DIST />' eq 'scientific7' ||
103: '<DIST />' eq 'rhes7' || '<DIST />' eq 'centos7' || '<DIST />' eq 'rhes8' ||
104: '<DIST />' eq 'centos8' || '<DIST />' eq 'oracle7' || '<DIST />' eq 'oracle8' ||
105: '<DIST />' eq 'rocky8' || '<DIST />' eq 'alma8' || '<DIST />' eq 'centos8-stream' ||
106: '<DIST />' eq 'centos9-stream' || '<DIST />' eq 'rhes9' || '<DIST />' eq 'oracle9' ||
107: '<DIST />' eq 'rocky9' || '<DIST />' eq 'alma9') {
1.5 raeburn 108: if (open(PIPE,"cat /etc/locale.conf |grep '^LANG' |")) {
109: print "Checking OS language";
110: if (<PIPE> =~ /^LANG="en/) {
111: print "... OK\n";
112: } else {
113: print $osmsg.
114: "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/locale.conf\n";
115: }
116: close(PIPE);
1.10 raeburn 117: }
1.15 raeburn 118: } elsif ('<DIST />' eq 'sles15') {
119: if (open(PIPE,"cat /etc/locale.conf |grep '^LANG' |")) {
120: print "Checking OS language";
121: if (<PIPE> =~ /^LANG=en/) {
122: print "... OK\n";
123: } else {
124: print $osmsg.
125: "It is recommended that you set LANG=en_US.UTF-8 in /etc/locale.conf\n";
126: }
127: close(PIPE);
128: }
1.2 raeburn 129: } else {
130: if (open(PIPE,"cat /etc/sysconfig/i18n |grep '^LANG' |")) {
131: print "Checking OS language";
132: if (<PIPE> =~ /^LANG="en/) {
133: print "... OK\n";
134: } else {
135: print $osmsg.
136: "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/sysconfig/i18n.\n";
137: }
138: close(PIPE);
1.1 golterma 139: }
140: }
141:
142: </perlscript>
143: </file>
144: </files>
1.2 raeburn 145: </piml>
146:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>