/[smeserver]/rpms/smeserver-audittools/sme8/smeserver-audittools-0.0.2-events.patch
ViewVC logotype

Contents of /rpms/smeserver-audittools/sme8/smeserver-audittools-0.0.2-events.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Tue Oct 7 15:47:39 2008 UTC (15 years, 7 months ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
New streams

1 diff -Nur -x '*.orig' -x '*.rej' smeserver-audittools-0.0.2/root/sbin/e-smith/audittools/events mezzanine_patched_smeserver-audittools-0.0.2/root/sbin/e-smith/audittools/events
2 --- smeserver-audittools-0.0.2/root/sbin/e-smith/audittools/events 1970-01-01 10:00:00.000000000 +1000
3 +++ mezzanine_patched_smeserver-audittools-0.0.2/root/sbin/e-smith/audittools/events 2008-01-09 11:48:06.000000000 +1100
4 @@ -0,0 +1,69 @@
5 +#!/usr/bin/perl -w
6 +
7 +#----------------------------------------------------------------------
8 +# copyright (C) 2006 Gordon Rowell <gordonr@gormand.com.au>
9 +#
10 +# This program is free software; you can redistribute it and/or modify
11 +# it under the terms of the GNU General Public License as published by
12 +# the Free Software Foundation; either version 2 of the License, or
13 +# (at your option) any later version.
14 +#
15 +# This program is distributed in the hope that it will be useful,
16 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
17 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 +# GNU General Public License for more details.
19 +#
20 +# You should have received a copy of the GNU General Public License
21 +# along with this program; if not, write to the Free Software
22 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 +#----------------------------------------------------------------------
24 +
25 +use strict;
26 +use warnings;
27 +
28 +use RPM2;
29 +use File::Find;
30 +use File::Path;
31 +use File::stat;
32 +
33 +# Files not owned by RPMs
34 +# Files modified since install by RPM
35 +# events from "non-standard" RPMs
36 +
37 +use RPM2;
38 +my $rpm2 = RPM2->open_rpm_db();
39 +
40 +find({ wanted => \&events }, "/etc/e-smith/events");
41 +
42 +sub events
43 +{
44 + return unless -f;
45 +
46 + my $template = $File::Find::name;
47 +
48 + my $status = rpm_status(name => $File::Find::name);
49 +
50 + return if ( $status eq "OWNED_BY_RPM");
51 +
52 + print "$File::Find::name: $status\n";
53 +}
54 +
55 +sub rpm_status
56 +{
57 + my (%options) = @_;
58 +
59 + my @rpms = $rpm2->find_by_file($options{name});
60 +
61 + return "MANUALLY_ADDED" unless (@rpms);
62 +
63 + return "MULTIPLE_RPM_OWNERS " . join(", ", map { $_->as_nvre } @rpms)
64 + if (@rpms >= 2);
65 +
66 + my $install_time = $rpms[0]->tag("INSTALLTIME");
67 +
68 + my $st = stat($options{name}) or die "Couldn't stat $options{name}: $!";
69 +
70 + return "MODIFIED " . $rpms[0]->as_nvre if ($st->mtime > $install_time);
71 +
72 + return "OWNED_BY_RPM";
73 +}

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed