[LON-CAPA-cvs] cvs: loncom /build Makefile doc/loncapafiles langcheck.piml

goltermann goltermann at source.lon-capa.org
Wed Nov 2 09:16:23 EDT 2011


goltermann		Wed Nov  2 13:16:23 2011 EDT

  Added files:                 
    /doc/loncapafiles	langcheck.piml 

  Modified files:              
    /loncom/build	Makefile 
  Log:
  Added a language check for root bash and OS. Non-english languages can lead to incorrect warnings. Only tested with CentOS but it should work for other distros too.
  
  
Index: loncom/build/Makefile
diff -u loncom/build/Makefile:1.197 loncom/build/Makefile:1.198
--- loncom/build/Makefile:1.197	Fri Mar 25 22:55:06 2011
+++ loncom/build/Makefile	Wed Nov  2 13:16:23 2011
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 
-# $Id: Makefile,v 1.197 2011/03/25 22:55:06 raeburn Exp $
+# $Id: Makefile,v 1.198 2011/11/02 13:16:23 goltermann Exp $
 
 # TYPICAL USAGE of this Makefile is primarily for two targets:
 # "make build" and "make install".
@@ -398,6 +398,11 @@
 	rm -f $(SOURCE)/tar_WARNINGS
 	make warningnote
 
+langcheck:
+	cat $(SOURCE)/doc/loncapafiles/langcheck.piml | \
+	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
+	tee -a WARNINGS
+
 ntpcheck:
 	cat $(SOURCE)/doc/loncapafiles/ntpcheck.piml | \
 	perl piml_parse.pl $(CATEGORY) $(DIST) "$(TARGET)" $(LAUNCH) | \
@@ -525,6 +530,7 @@
 	make update_queue_slots
 	make modify_config_files
 	make clearoutoldspreadsheetcache
+	make langcheck	
 	make chkconfig
 	make rpmcheck
 	make ntpcheck

Index: doc/loncapafiles/langcheck.piml
+++ doc/loncapafiles/langcheck.piml
<piml>
<targetroot>/</targetroot>
<files>
<file>
<target dist="default"></target>
<perlscript mode="fg">

print "Checking root bash language";
my $lang = `locale`;
if ($lang =~ "LANG=en") {
    print "... OK\n";
} else {
    print "\n**** WARNING: You seem to have a non-english root bash. This can cause incorrect error messages.\n".
        "    It is recommended to set your bash language to English.\n";   
}

my $file = "/etc/sysconfig/i18n";
if (open(my $IN,'<'.$file)) {
    print "Checking OS language";
    if (<$IN> =~ "LANG=\"en") {
        print "... OK\n";
    } else {
        print "\n**** WARNING: You seem to have a non-english operating system. ".
        "It is recommended to set the language in /etc/sysconfig/i18n to English.\n";
    }
}

</perlscript>
</file>
</files>
</piml>



More information about the LON-CAPA-cvs mailing list