Annotation of doc/loncapafiles/langcheck.piml, revision 1.33

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: 
        !             5: <!-- $Id: langheck.piml,v 1.33 2023/05/10 06:10:29 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: -->
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 = &lt;PIPE&gt;;
                     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 (&lt;PIPE&gt; =~ /^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.31      raeburn    83:          '<DIST />' eq 'ubuntu20' || '<DIST />' eq 'ubuntu22') {
1.2       raeburn    84:     if (open(PIPE,"cat /etc/default/locale |grep '^LANG' |")) {
                     85:         print "Checking OS language";
1.29      raeburn    86:         if (&lt;PIPE&gt; =~ /^LANG=en/) {
1.2       raeburn    87:             print "... OK\n";
                     88:         } else {
                     89:             print $osmsg.
1.29      raeburn    90:                   "It is recommended that you set LANG=en_US.UTF-8 in /etc/default/locale\n";
1.2       raeburn    91:         }
                     92:         close(PIPE);
                     93:     }
1.7       raeburn    94: } elsif ('<DIST />' eq 'fedora18' || '<DIST />' eq 'fedora19' || '<DIST />' eq 'fedora20' ||
1.12      raeburn    95:          '<DIST />' eq 'fedora21' || '<DIST />' eq 'fedora22' || '<DIST />' eq 'fedora23' ||
1.13      raeburn    96:          '<DIST />' eq 'fedora24' || '<DIST />' eq 'fedora25' || '<DIST />' eq 'fedora26' ||
1.15      raeburn    97:          '<DIST />' eq 'fedora27' || '<DIST />' eq 'fedora28' || '<DIST />' eq 'fedora29' ||
1.23      raeburn    98:          '<DIST />' eq 'fedora30' || '<DIST />' eq 'fedora31' || '<DIST />' eq 'fedora32' ||
1.26      raeburn    99:          '<DIST />' eq 'fedora33' || '<DIST />' eq 'fedora34' || '<DIST />' eq 'fedora35' || 
1.32      raeburn   100:          '<DIST />' eq 'fedora36' || '<DIST />' eq 'fedora37' || '<DIST />' eq 'fedora38' ||
1.26      raeburn   101:          '<DIST />' eq 'rhes7'    || '<DIST />' eq 'centos7'  || '<DIST />' eq 'scientific7' ||
                    102:          '<DIST />' eq 'rhes8'    || '<DIST />' eq 'centos8'  || '<DIST />' eq 'oracle7'  ||
1.28      raeburn   103:          '<DIST />' eq 'oracle8'  || '<DIST />' eq 'rocky8'   || '<DIST />' eq 'alma8'    ||
1.30      raeburn   104:          '<DIST />' eq 'centos8-stream' || '<DIST />' eq 'centos9-stream' || '<DIST />' eq 'rhes9' ||
                    105:          '<DIST />' eq 'oracle9'  || '<DIST />' eq 'rocky9'  || '<DIST />' eq 'alma9')  {
1.5       raeburn   106:     if (open(PIPE,"cat /etc/locale.conf |grep '^LANG' |")) {
                    107:         print "Checking OS language";
                    108:         if (&lt;PIPE&gt; =~ /^LANG="en/) {
                    109:             print "... OK\n";
                    110:         } else {
                    111:             print $osmsg.
                    112:                   "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/locale.conf\n";
                    113:         }
                    114:         close(PIPE);
1.10      raeburn   115:     }
1.15      raeburn   116: } elsif ('<DIST />' eq 'sles15') {
                    117:     if (open(PIPE,"cat /etc/locale.conf |grep '^LANG' |")) {
                    118:         print "Checking OS language";
                    119:         if (&lt;PIPE&gt; =~ /^LANG=en/) {
                    120:             print "... OK\n";
                    121:         } else {
                    122:             print $osmsg.
                    123:                   "It is recommended that you set LANG=en_US.UTF-8 in /etc/locale.conf\n";
                    124:         }
                    125:         close(PIPE);
                    126:     }
1.2       raeburn   127: } else {
                    128:     if (open(PIPE,"cat /etc/sysconfig/i18n |grep '^LANG' |")) {
                    129:         print "Checking OS language";
                    130:         if (&lt;PIPE&gt; =~ /^LANG="en/) {
                    131:             print "... OK\n";
                    132:         } else {
                    133:             print $osmsg.
                    134:                   "It is recommended that you set LANG=\"en_US.UTF-8\" in /etc/sysconfig/i18n.\n";
                    135:         }
                    136:         close(PIPE);
1.1       golterma  137:     }
                    138: }
                    139: 
                    140: </perlscript>
                    141: </file>
                    142: </files>
1.2       raeburn   143: </piml>
                    144: 

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