1: <!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN"
2: "http://lpml.sourceforge.net/DTD/piml.dtd">
3: <!-- langcheck.piml -->
4:
5: <!-- $Id: langcheck.piml,v 1.39 2024/11/15 16:25:30 raeburn Exp $ -->
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: -->
30: <piml>
31: <targetroot>/</targetroot>
32: <files>
33: <file>
34: <target dist="default"></target>
35: <perlscript mode="fg">
36:
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: }
62: }
63:
64: my $osmsg = "\n**** WARNING: You seem to have a non-English operating system.\n";
65:
66: if ('<DIST />' eq 'sles9' || '<DIST />' eq 'sles10' || '<DIST />' eq 'sles11' || '<DIST />' eq 'sles12' ||
67: '<DIST />' eq 'suse11.1' || '<DIST />' eq 'suse11.2' || '<DIST />' eq 'suse11.3' ||
68: '<DIST />' eq 'suse11.4' || '<DIST />' eq 'suse12.1' || '<DIST />' eq 'suse12.2' ||
69: '<DIST />' eq 'suse12.3' || '<DIST />' eq 'suse13.1' || '<DIST />' eq 'suse13.2') {
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' ||
81: '<DIST />' eq 'ubuntu8' || '<DIST />' eq 'ubuntu10' || '<DIST />' eq 'ubuntu12' ||
82: '<DIST />' eq 'ubuntu14' || '<DIST />' eq 'ubuntu16' || '<DIST />' eq 'ubuntu18' ||
83: '<DIST />' eq 'ubuntu20' || '<DIST />' eq 'ubuntu22' || '<DIST />' eq 'ubuntu24' ||
84: '<DIST />' eq 'debian10' || '<DIST />' eq 'debian11' || '<DIST />' eq 'debian12') {
85: if (open(PIPE,"cat /etc/default/locale |grep '^LANG' |")) {
86: print "Checking OS language";
87: if (<PIPE> =~ /^LANG="?en/) {
88: print "... OK\n";
89: } else {
90: print $osmsg.
91: "It is recommended that you set LANG=en_US.UTF-8 in /etc/default/locale\n";
92: }
93: close(PIPE);
94: }
95: } elsif ('<DIST />' eq 'fedora18' || '<DIST />' eq 'fedora19' || '<DIST />' eq 'fedora20' ||
96: '<DIST />' eq 'fedora21' || '<DIST />' eq 'fedora22' || '<DIST />' eq 'fedora23' ||
97: '<DIST />' eq 'fedora24' || '<DIST />' eq 'fedora25' || '<DIST />' eq 'fedora26' ||
98: '<DIST />' eq 'fedora27' || '<DIST />' eq 'fedora28' || '<DIST />' eq 'fedora29' ||
99: '<DIST />' eq 'fedora30' || '<DIST />' eq 'fedora31' || '<DIST />' eq 'fedora32' ||
100: '<DIST />' eq 'fedora33' || '<DIST />' eq 'fedora34' || '<DIST />' eq 'fedora35' ||
101: '<DIST />' eq 'fedora36' || '<DIST />' eq 'fedora37' || '<DIST />' eq 'fedora38' ||
102: '<DIST />' eq 'fedora39' || '<DIST />' eq 'fedora40' || '<DIST />' eq 'fedora41' ||
103: '<DIST />' eq 'scientific7' || '<DIST />' eq 'rhes7' || '<DIST />' eq 'centos7' ||
104: '<DIST />' eq 'rhes8' || '<DIST />' eq 'centos8' || '<DIST />' eq 'oracle7' ||
105: '<DIST />' eq 'oracle8' || '<DIST />' eq 'rocky8' || '<DIST />' eq 'alma8' ||
106: '<DIST />' eq 'centos8-stream' || '<DIST />' eq 'centos9-stream' || '<DIST />' eq 'rhes9' ||
107: '<DIST />' eq 'oracle9' || '<DIST />' eq 'rocky9' || '<DIST />' eq 'alma9') {
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);
117: }
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: }
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);
139: }
140: }
141:
142: </perlscript>
143: </file>
144: </files>
145: </piml>
146:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>