[LON-CAPA-cvs] cvs: loncom /build CHECKRPMS.suse
raeburn
lon-capa-cvs@mail.lon-capa.org
Fri, 29 Jul 2005 21:14:07 -0000
raeburn Fri Jul 29 17:14:07 2005 EDT
Modified files:
/loncom/build CHECKRPMS.suse
Log:
Send e-mail when online_update determines that there are packages to update with new patches.
Index: loncom/build/CHECKRPMS.suse
diff -u loncom/build/CHECKRPMS.suse:1.1 loncom/build/CHECKRPMS.suse:1.2
--- loncom/build/CHECKRPMS.suse:1.1 Wed Apr 13 14:56:46 2005
+++ loncom/build/CHECKRPMS.suse Fri Jul 29 17:14:03 2005
@@ -2,7 +2,7 @@
#
# The LearningOnline Network with CAPA
#
-# $Id: CHECKRPMS.suse,v 1.1 2005/04/13 18:56:46 albertel Exp $
+# $Id: CHECKRPMS.suse,v 1.2 2005/07/29 21:14:03 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -79,22 +79,21 @@
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) {
+# Execute online_update command to check for updates
+if (open (PIPE, "$you -d -k -l en 2>&1 |")) {
+ my $output=<PIPE>;
+ close(PIPE);
+ chomp $output;
+ unless ($output eq 'No updates available.') {
+ my $command = $you.' -s -k -l en |grep ^[^I] >>'.$tmpfile;
+ system($command);
+
+ $subj.= ' RPMS to upgrade';
+ # Send email
+ system(qq{mail -s '$subj' $emailto < $tmpfile});
+ }
+} else {
# 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.
}