File sendmailanalyzer.spec of Package sendmailanalyzer
#
# spec file for package sendmailanalyzer
#
# Copyright (c) 2011 Stefan Jakobs <projects@localside.net>
#
# 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/
#
Name: sendmailanalyzer
Version: 9.0
Release: 1
License: GPL-3.0+
Summary: A free Sendmail/Postfix log analyzer
Url: http://sareport.darold.net/index.html
Group: System/Monitoring
Source: %{name}-%{version}.tar.gz
Source1: %{name}.init
Source2: %{name}.httpd.conf
%if 0%{?suse_version} >= 01210
Source3: %{name}.service
BuildRequires: systemd
%{?systemd_requires}
%endif
Source4: sa_cache.3
Source5: sa_cache.pod
Source6: create_manfile.pl
Source7: README.SUSE
BuildRequires: perl
BuildRequires: perl(MIME::Base64)
BuildRequires: perl(MIME::QuotedPrint)
BuildRequires: sed
PreReq: %insserv_prereq
Requires: perl(MIME::Base64)
Requires: perl(MIME::QuotedPrint)
Requires: perl = %{perl_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
SendmailAnalyzer as is name suggest is a free Sendmail/Postfix log analyzer.
It process maillog files and generate dynamic statistics in HTML and graphical
output. The reports are generated in real time so that it let you know at any
moment what is going on your mail servers. It use time (hour, day, month and
year views) and cross-linked navigation for easy use.
SendmailAnalyzer is easy to install and highly configurable to match the
dozen of Sendmail possible configurations. It also support report for all the
major milter or sendmail filters like SpamAssassin, MailScanner, Clamav,
Amavis, RBL check, J-ChkMail, etc. SendmailAnalyzer is really helpful for
IT reporting.
Collected data are stored in flat files that are automatically archived or
delete to keep disk space. All reports before the current day are cached to
save system resources and are displayed in less than 1 second.
%package www
Summary: Webserver Part for SendmailAnalyzer
Group: System/Monitoring
PreReq: apache2
Requires: apache2-mod_perl
Requires: %{name} = %{version}
%description www
This package includes the needed files to see the SendmailAnalyzer
reports via an apache webserver with your browser.
%prep
%setup -q
install -m644 %{SOURCE7} .
%build
sed -i 's/\(sendmailanalyzer.conf\).orig/\1/' Makefile.PL
perl Makefile.PL \
INSTALLDIRS="vendor" \
QUIET=1 \
LOGFILE=%{_localstatedir}/log/mail \
BINDIR=%{_sbindir} \
CONFDIR=%{_sysconfdir} \
PIDDIR=%{_localstatedir}/run \
BASEDIR=%{_localstatedir}/lib/%{name} \
HTMLDIR=/srv/www/%{name} \
MANDIR=%{_mandir}/man3 \
DOCDIR=%{_docdir}/%{name} \
DESTDIR=%{buildroot}
make %{?_smp_mflags} OPTIMIZE="%{optflags}"
%check
make test
%install
make install
rm -rf %{buildroot}%{perl_archlib}/perllocal.pod %{buildroot}%{perl_vendorarch}/auto/%{name}/.packlist
if [ ! -d %{buildroot}/%{_localstatedir}/lib/%{name} ] ; then
mkdir -p %{buildroot}/%{_localstatedir}/lib/%{name}
fi
# install init and service files
install -Dm0755 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/%{name}
ln -sf %{_sysconfdir}/init.d/%{name} %{buildroot}/%{_sbindir}/rc%{name}
%if 0%{?suse_version} >= 01210
install -Dm644 %{SOURCE3} %{buildroot}/%{_unitdir}/%{name}.service
%endif
# install apache configuration
mkdir -p %{buildroot}/%{_sysconfdir}/apache2/conf.d
sed -e "s|__webdir__|/srv/www/%{name}|g" %{SOURCE2} > %{buildroot}/%{_sysconfdir}/apache2/conf.d/%{name}.conf
# install missing manpage
install -m644 %{SOURCE4} %{buildroot}%{_mandir}/man3/sa_cache.3
# make rpmlint happy: remove INSTALL file
rm %{buildroot}/%{_docdir}/%{name}/INSTALL
%clean
rm -rf %{buildroot}
%pre www
if [ "$1" = "1" ]; then
# enable perl in apache config
if [ -x %{_sbindir}/a2enmod ]; then
if grep -q perl %{_sysconfdir}/sysconfig/apache2 1>&2 2>/dev/null; then
%{_sbindir}/a2enmod perl >/dev/null || :
fi
fi
if [ -x %{_sbindir}/a2enflag ]; then
if grep -q SAREPORT %{_sysconfdir}/sysconfig/apache2 1>&2 2>/dev/null; then
%{_sbindir}/a2enflag SAREPORT >/dev/null || :
fi
fi
fi
%post www
%restart_on_update apache2
%postun www
%restart_on_update apache2
%if 0%{?suse_version} >= 1210
%pre
%service_add_pre %{name}.service
%post
%service_add_post %{name}.service
%{fillup_and_insserv -f %{name}}
%preun
%service_del_preun %{name}.service
%stop_on_removal %{name}
%postun
%service_del_postun %{name}.service
%restart_on_update %{name}
%insserv_cleanup
%else
%post
%{fillup_and_insserv -f %{name}}
%preun
%stop_on_removal %{name}
%postun
%restart_on_update %{name}
%insserv_cleanup
%endif
%files
%defattr(-, root, root, -)
%doc ChangeLog README* LICENSE
%doc %{_mandir}/man3/*.3*
%config(noreplace) %{_sysconfdir}/%{name}.conf
%dir /srv/www/%{name}
%dir %{_localstatedir}/lib/%{name}
%{_sbindir}/sa_cache
%{_sbindir}/%{name}
%{_sbindir}/rc%{name}
%{_sysconfdir}/init.d/%{name}
%if 0%{?suse_version} >= 01210
%{_unitdir}/%{name}.service
%endif
%files www
%defattr(-, root, root, -)
%doc LICENSE
%config(noreplace) %{_sysconfdir}/apache2/conf.d/%{name}.conf
/srv/www/%{name}/*
%changelog