File logdigest.spec of Package logdigest

#
# spec file for package logdigest (Version 0.2.4)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           logdigest
Url:            http://sourceforge.net/projects/logdigest
Version:        0.2.4
Release:        1
Summary:        Mail Digests of System Log Files to the System Administrator
License:        GNU General Public License (GPL)
Group:          System/Monitoring
AutoReqProv:    on
PreReq:         /bin/chmod /bin/touch
#Source:         http://www.cmdline.net/logdigest/logdigest-%{version}.tar.bz2
Source:         http://dfn.dl.sourceforge.net/sourceforge/logdigest/logdigest-%{version}.tar.bz2
Source1:        logdigest-all-ignores-autogeneration
#Patch:          logdigest-0.1.7-ignores.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} >= 1010
# procinfo is needed when EXTENDED_STATS=yes
Recommends:     cron procinfo
%endif

%description
Logdigest, run by cron at night, greps through system log files
(var/log/messages, /var/log/mail, etc.) to find "interesting" content.

Lines matching the regular expressions in /etc/logdigest are simply
ignored. More expressions can be added to /etc/logdigest/ignore.local.
See /etc/logdigest/config for some general settings.

The results are mailed to the sysadmin daily.



Authors:
--------
    Peter Poeml <poeml@cmdline.net>
    Craig H. Rowland <crowland@psionic.com>

%prep
%setup -n logdigest-%{version}
#%patch -p1

%build
export CFLAGS="$RPM_OPT_FLAGS"
aclocal
autoconf
automake --add-missing
./configure --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --with-tmpdir=/var/lib/logdigest
make

%install
make DESTDIR=$RPM_BUILD_ROOT install

mkdir -p %{buildroot}/usr/share/logdigest
cp -p %{S:1} %{buildroot}/usr/share/logdigest/

mkdir -p %{buildroot}/etc/cron.d
cat >%{buildroot}/etc/cron.d/logdigest-all-ignores-autogeneration <<-EOF
# Cron snippet which concatenates the ignore files into a single file
# /etc/logdigest/ignores.autogenerated, pruned by spaces.
#
# That file can be used by other programs (e.g. eddie-tool) for 
# log-scanning.

-*/30 * * * *   root    /usr/share/logdigest/logdigest-all-ignores-autogeneration
EOF

%post
# add .local conf files if they are not there
cd etc/logdigest
for i in alarming ignore; do 
        test -e $i.local || { touch $i.local; chmod 600 $i.local; }
done
#
/usr/share/logdigest/logdigest-all-ignores-autogeneration

%preun
# update?
if [ ${FIRST_ARG:-0} -gt 1 ]; then
	exit 0
fi

# remove .local conf files if empty	
cd etc/logdigest
for i in alarming ignore; do 
	test -s $i.local || rm -f $i.local
done

%files
%defattr(-,root,root)
%doc README AUTHORS COPYING ChangeLog INSTALL NEWS TODO BUGS VERSION
%dir /etc/logdigest
%config(noreplace) /etc/logdigest/*
/usr/bin/logtail
/var/lib/logdigest
/etc/cron.daily/logdigest
%config %attr(640,root,root) /etc/cron.d/logdigest-all-ignores-autogeneration
%dir /usr/share/logdigest
%attr(755,root,root) /usr/share/logdigest/logdigest-all-ignores-autogeneration

%changelog
openSUSE Build Service is sponsored by