Removed zz-fortune patch as zz-disk_space is run every time anyway

This commit is contained in:
Karel Klíč 2010-04-19 14:25:34 +00:00
parent aba02be99a
commit e7221a039a
2 changed files with 5 additions and 72 deletions

View File

@ -1,63 +0,0 @@
From 767088a99774ee2b0b68433c158b8facd4368a6b Mon Sep 17 00:00:00 2001
From: Karel Klic <kklic@redhat.com>
Date: Wed, 14 Apr 2010 11:44:46 +0200
Subject: [PATCH] Do not run zz-fortune if logwatch report is otherwise empty.
Patch by Penelope Fudd
Red Hat bugzilla #573450
---
scripts/logwatch.pl | 4 ++++
scripts/services/zz-fortune | 19 +++++++++++++------
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/scripts/logwatch.pl b/scripts/logwatch.pl
index 12c935e..452dde2 100755
--- a/scripts/logwatch.pl
+++ b/scripts/logwatch.pl
@@ -1347,6 +1347,10 @@ sub parselogs {
output( $index_par, "\n --------------------- $ServiceData{$Service}{'title'} $BeginVar ------------------------ \n\n", "line");
}
$has_output = 1;
+ # Set the environment variable indicating that the report
+ # is not empty. zz-fortune service uses this to determine
+ # whether it should output something or not.
+ $ENV{'LOGWATCH_HAS_OUTPUT'} = 1;
}
output( $index_par, $ThisLine, "line");
}
diff --git a/scripts/services/zz-fortune b/scripts/services/zz-fortune
index 77902fa..e290b75 100755
--- a/scripts/services/zz-fortune
+++ b/scripts/services/zz-fortune
@@ -22,15 +22,22 @@
my $env = ( $ENV{'REAL_LANG'} ? "LANG=".$ENV{'REAL_LANG'}." " : "" ).
( $ENV{'REAL_LC_ALL'} ? "LC_ALL=".$ENV{'REAL_LC_ALL'}." " : "" );
+# Do not call fortune if it is the only service that is active.
+# Solves the issue that the report is sent every time the logwatch
+# is run even when nothing happened on the machine.
+if (! defined $ENV{'LOGWATCH_HAS_OUTPUT'}) {
+ exit 0;
+}
+
if (($ENV{'PRINTING'} eq "y" ) && (-f "/usr/games/fortune")) {
- #print "\n\n------------------ Fortune --------------------\n\n";
- system("$env /usr/games/fortune");
- print "\n";
+ #print "\n\n------------------ Fortune --------------------\n\n";
+ system("$env /usr/games/fortune");
+ print "\n";
}
elsif (($ENV{'PRINTING'} eq "y" ) && (-f "/usr/bin/fortune")) {
- #print "\n\n------------------ Fortune --------------------\n\n";
- system("$env /usr/bin/fortune");
- print "\n";
+ #print "\n\n------------------ Fortune --------------------\n\n";
+ system("$env /usr/bin/fortune");
+ print "\n";
}
# vi: shiftwidth=3 tabstop=3 syntax=perl et
--
1.6.6.1

View File

@ -1,7 +1,7 @@
Summary: A log file analysis program
Name: logwatch
Version: 7.3.6
Release: 52%{?dist}
Release: 53%{?dist}
License: MIT
Group: Applications/System
URL: http://www.logwatch.org/
@ -132,13 +132,6 @@ Patch69: logwatch-7.3.6-named7.patch
Patch70: logwatch-7.3.6-dovecot3.patch
# Sent, not applied yet.
Patch71: logwatch-7.3.6-sendmail2.patch
# Not send to upstream.
# Do not send reports with zz-fortune only.
# rhbz#573450
# Negative consequence is that it breaks
# `logwatch --service zz-fortune --print`
# but noboty runs this anyway.
Patch72: logwatch-7.3.6-zz-fortune.patch
# Sent to upstream.
# Adds manpages for configuration files.
# rhbz#525644
@ -221,7 +214,6 @@ of the package on many systems.
%patch69 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
rm -f scripts/services/*.orig
@ -338,6 +330,10 @@ rm -rf %{buildroot}
%doc License project/CHANGES
%changelog
* Mon Apr 19 2010 Karel Klic <kklic@redhat.com> 7.3.6-53
- Removed zz-fortune patch as zz-disk_space is run every
time anyway.
* Fri Apr 16 2010 Karel Klic <kklic@redhat.com> 7.3.6-52
- Updated the previously added patches to apply with --fuzz=0