[LON-CAPA-dev] some more SuSE patches

Martin Siegert lon-capa-dev@mail.lon-capa.org
Mon, 11 Apr 2005 14:19:31 -0700


--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

I am attaching tree patches:

- loncapa-1.3.3-ntpcheck.patch
  fixes ntpcheck.piml so that it works under SuSE as well (where ntpd
  quite annoyingly is renamed to xntpd).
- loncapa-1.3.3-splitsize.patch
  this one has annoyed me for quite a while (probably since loncapa-1.2.0):
  All our RH 7.3 boxes send the daily email notifications in several pieces
  (mime type message/partial) requiring an email reader that can reassemble
  the pieces. Since I did not have such an email reader I have deleted these
  daily notifications ever since. My SuSE boxes send the daily notifications
  in one piece but with the wrong mime type of text/plain, which is quite
  annoying as well. The reason is the send_mail routine in loncron:
  it uses metasend unless that fails in which case mail is used. Under
  SuSE I never installed the metamail rpm package, thus mail was used and
  no mime type was set. However, metamail by default uses a ridiculously
  small "slitsize", i.e., even the smallest email messages will be cut into
  bits and pieces. Solution: set the spiltsize explicitly and then add
  "metamail" to the LONCAPA-prerequisites.
- CHECKRPMS.suse
  version that works under suse. I am assuming the /etc/youservers has
  been configured already. I do not know what happens (ar there defaults?)
  if you don't.

Cheers,
Martin

--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="loncapa-1.3.3-ntpcheck.patch"

--- loncapa-1.3.2/doc/loncapafiles/ntpcheck.piml.orig	2005-03-22 18:33:46.000000000 -0800
+++ loncapa-1.3.2/doc/loncapafiles/ntpcheck.piml	2005-03-22 19:15:31.000000000 -0800
@@ -37,16 +37,21 @@
 <perlscript mode="fg">
 print "Checking to be sure the Network Time Protocol is running properly.\n";
 print "For more information on ntpd please see http://www.ntp.org/\n";
-if (! -e "/etc/init.d/ntpd") {
+my $NTPD;
+if (-e "/etc/init.d/ntpd") {
+   $NTPD = "ntpd";
+} elsif (-e "/etc/init.d/xntpd") {
+   $NTPD = "xntpd";
+} else {
     print "ntp is not installed.\n";
     exit;
 }
-my $value = `/etc/init.d/ntpd status`;
-if ($value !~ / running/) {
-    print "WARNING: ntp is installed but is not currently running.\nPlease verify the configuration of ntp in /etc/ntp.conf and /etc/ntp/step-tickers\nStart ntp by executing\n /etc/init.d/ntpd start\n";
+my $value = `/etc/init.d/$NTPD status`;
+if ($value !~ /running/) {
+    print "WARNING: ntp is installed but is not currently running.\nPlease verify the configuration of ntp in /etc/ntp.conf and /etc/ntp/step-tickers\nStart ntp by executing\n /etc/init.d/$NTPD start\n";
 }
 # chkconfig barfs to stderr if the target isn't set up right.
-my $restartchk = `/sbin/chkconfig --list ntpd 2>/dev/null`;
+my $restartchk = `/sbin/chkconfig --list $NTPD 2>/dev/null`;
 if ($restartchk eq '') {
     print "**** WARNING: ntpd is either not installed or not configured to run at boot.\n";
     exit;
@@ -57,7 +62,7 @@
     exit;
 }
 if ($restartchk !~ /\s3:on/) {
-    print "**** WARNING: ntpd is not set to start at runlevel 3.  To correct this run:\n/sbin/chkconfig --level 345 ntpd on\n";
+    print "**** WARNING: ntpd is not set to start at runlevel 3.  To correct this run:\n/sbin/chkconfig --level 345 $NTPD on\n";
     exit;
 }
 if ($restartchk !~ /\s5:on/) {

--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="loncapa-1.3.3-splitsize.patch"

--- loncapa-1.3.3/loncom/loncron.orig	2005-04-11 13:45:23.166250153 -0700
+++ loncapa-1.3.3/loncom/loncron	2005-04-11 13:45:41.854190236 -0700
@@ -559,7 +559,7 @@
     }
     my $subj="LON: $perlvar{'lonHostID'} E:$errors W:$warnings N:$notices"; 
 
-    my $result=system("metasend -b -t $emailto -s '$subj' -f $statusdir/index.html -m text/html >& /dev/null");
+    my $result=system("metasend -b -S 4000000 -t $emailto -s '$subj' -f $statusdir/index.html -m text/html >& /dev/null");
     if ($result != 0) {
 	$result=system("mail -s '$subj' $emailto < $statusdir/index.html");
     }

--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="CHECKRPMS.suse"

#!/usr/bin/perl -w
#
# The LearningOnline Network with CAPA
#
# $Id: CHECKRPMS.fedora,v 1.2 2004/07/19 21:01:51 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# /home/httpd/html/adm/gpl.txt
#
# http://www.lon-capa.org/
#
# (Navigate problems for statistical reports
#

=pod

=head1 NAME

B<CHECKRPMS> - automated status report about RPMs on a system, Yum version.

=head1 DESCRIPTION

This file automates the usage of yum to check for available updates
to Fedora systems.

Must be run as root or www.

=cut

use strict;
use lib '/home/httpd/lib/perl/';
use LONCAPA::Configuration;

my $you = '/usr/bin/online_update';
my $tmpfile = '/tmp/CHECKRPMS.'.$$;

#
# Determine who we email
my %perlvar=%{LONCAPA::Configuration::read_conf('loncapa.conf')};
my $emailto = "$perlvar{'lonAdmEMail'}";
my $subj=$perlvar{'lonHostID'};
undef(%perlvar);

#
# Put some nice text in $tmpfile
my $hostname = `hostname`;
chomp($hostname);
open(TMPFILE,">$tmpfile");
print TMPFILE localtime(time).'    '.$hostname."\n";
print TMPFILE <<ENDHEADER;
Your system needs to be updated.  Please execute (as root) 

you

to bring it up to date.

This is very important for the security of your server.  The table below
lists the packages which need to be updated.

ENDHEADER

close(TMPFILE);

#
# Execute yum command
my $command = $you.' -s -k -l en '.'>>'.$tmpfile;
system($command);

my $returnvalue = $?>>8;

#
# Determine status of yum run
if (100 == $returnvalue) {
    $subj.= ' RPMS to upgrade';
    # Send email
    system(qq{mail -s '$subj' $emailto < $tmpfile});
} elsif (0 != $returnvalue) {
    # Send email
    $subj.= ' Error running RPM update script';
    system(qq{mail -s '$subj' $emailto < $tmpfile});
} else {
    # you returned 0, so everything is up to date.
}

--/04w6evG8XlLl3ft--