File sqlgrey.spec of Package sqlgrey

Summary:   Postfix SQL based grey-listing policy service
Name:      sqlgrey
Version:   1.8.0rc2
Release:   0
License:   GPL-2.0
Url:       http://sqlgrey.sourceforge.net
Group:     Productivity/Networking/Email/Servers
Source0:   %{name}-%{version}.tar.bz2
Source1:   sqlgrey.init.suse
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
PreReq:    %insserv_prereq %fillup_prereq
PreReq:    pwdutils
Requires:  perl-DBI perl-DBD-Pg perl-IO-Multiplex perl-Net-Server postfix >= 2.1

%description
SQLgrey is a Postfix grey-listing policy service with auto-white-listing
written in Perl with SQL database as storage backend.
Greylisting stops 50 to 90 % junk mails (spam and virus) before they
reach your Postfix server (saves BW, user time and CPU time).

%prep
%setup

%build
make

%install
make install ROOTDIR=$RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT/var/lib/sqlgrey
install -m 700  %{SOURCE1} $RPM_BUILD_ROOT/etc/init.d/%{name}
ln -s /etc/init.d/%{name} %{buildroot}/usr/sbin/rc%{name}

%pre
getent group sqlgrey > /dev/null || /usr/sbin/groupadd sqlgrey
getent passwd sqlgrey > /dev/null || /usr/sbin/useradd -g sqlgrey \
     -d /var/lib/sqlgrey sqlgrey

%post
touch /var/run/sqlgrey.pid

%postun
%restart_on_update sqlgrey
%insserv_cleanup
if [ $1 = 0 ]; then
   if [ `getent passwd sqlgrey | wc -l` = 1 ]; then
      /usr/sbin/userdel sqlgrey
   fi
   if [ `getent group sqlgrey | wc -l` = 1 ]; then
      /usr/sbin/groupdel sqlgrey
   fi
fi

%preun
%stop_on_removal sqlgrey

%clean
make clean

%files
%defattr(-,root,root)
%attr(700,root,root) /usr/sbin/sqlgrey
%attr(700,root,root) /etc/init.d/%{name}
/usr/sbin/rc%{name}
/usr/sbin/update_sqlgrey_config
/usr/bin/sqlgrey-logstats.pl
/usr/share/man/man1/sqlgrey.1*
%doc README* HOWTO Changelog FAQ TODO
%dir %attr(755,root,root) /etc/sqlgrey
%defattr(644,root,root)
%config(noreplace) /etc/sqlgrey/sqlgrey.conf
%config(noreplace) /etc/sqlgrey/clients_ip_whitelist
%config(noreplace) /etc/sqlgrey/clients_fqdn_whitelist
%config(noreplace) /etc/sqlgrey/dyn_fqdn.regexp
%config(noreplace) /etc/sqlgrey/smtp_server.regexp
%config(noreplace) /etc/sqlgrey/discrimination.regexp
/etc/sqlgrey/README
%dir %attr(-,sqlgrey,sqlgrey) /var/lib/sqlgrey

%changelog
* Thu Oct 29 2009 Matthias Bach <marix@marix.org> - 1.6.8
 - Adapted to openSUSE 11.1 (FHS 2.2)

* Sun Nov 05 2006 Peter Nixon <peter+rpmspam@suntel.com.tr> - 1.6.8
 - Package for SUSE

* Mon Oct 24 2005 Lionel Bouton <lionel-dev@bouton.name> - 1.6.7
 - 1.6.7 release
 - bugfix for superfluous log messages

* Wed Sep 14 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.6.6 release
 - bugfix for a multiple instance race condition (thanks to Steffen Plotner)

* Tue Jul 26 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.6.5 release
 - clean_method support bugfix

* Thu Jul 07 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.6.3 release
 - the database cleanup method is configurable, the default is now
   safe on all configurations
     
* Fri Jul 04 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.6.2 release
 - DB handles aren't destroyed by the DBD driver anymore,
 - spec file updated to conform to RPM 4,
 - logstat bugfix,
 - protect Syslog calls from "%?" strings

* Fri Jun 24 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.6.1 release
 - sqlgrey-logstats.pl fixes (support for more hostnames in logs,
   better from awl matches report)

* Thu Jun 16 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.6.0 release
 - fix for alternate conf_dir
 - fix for timestamp handling in log parser
 - log parser cleanup
 - added README.PERF and documentation cleanup

* Tue Jun 07 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.5.9 release
 - fix for MySQL's mishandling of timestamps
 - better log parser

* Thu Jun 02 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.5.8 release
 - fix for Makefile: rpmbuild didn't work

* Wed Jun 01 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.5.7 release
 - fix for a memory leak
 - config directory now user-configurable
 - preliminary log analyser

* Mon May 02 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.5.6 release
 - fix for MySQL disconnection crash
 - IPv6 support
 - Optin/optout support

* Tue Apr 25 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.5.5 release
 - small fix for SRS (again!)
 - small fix for deverp code
 - log types

* Tue Mar 15 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.5.4 release
 - fix for regexp compilation (regexp in fqdn_whitelists didn't work)
  
* Sat Mar 05 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.5.3 release
 - the cleanup is now done in a separate process to avoid stalling the service

* Thu Mar 03 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.5.2 release
 - optimize SQL queries by avoiding some now() function calls

* Wed Mar 02 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.5.1 release
 - replaced smart algorithm with Michel Bouissou's one

* Wed Feb 23 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.5.0 release
 - drop support for obsolete command-line parameters
 - migrate databases to a new layout :
  . first_seen added to the AWLs
  . optimize AWL Primary Keys
  . add indexes

* Mon Feb 21 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.4.8 release
 - AWL performance bugfix
 - bad handling of database init errors fixed
   
* Fri Feb 18 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.4.7 release
 - MAIL FROM: <> bugfix
  
* Fri Feb 18 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.4.6 release
 - update_sqlgrey_whitelists fix
 - removed superfluous regexp in deVERP code

* Thu Feb 17 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.4.5 release
 - update_sqlgrey_whitelists temporary directory fixes from Michel Bouissou
 - return code configurable patch from Michel Bouissou
 - VERP and SRS tuning, with input from Michel Bouissou
 - VERP and SRS normalisation is used only in the AWLs

* Mon Feb 14 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.4.4 release
 - Autowhitelists understand SRS
 - more VERP support for autowhitelists
 - SQLgrey can warn by mail when the database is unavailable
 - update_sqlgrey_whitelists doesn't rely on mktemp's '-t' parameter anymore.

* Sun Feb 06 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.4.3 release
 - log to stdout when not in daemon mode
 - added update_sqlgrey_whitelists script
   whitelists can now be fetched from repositories
      
* Thu Jan 13 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.4.2 release
 - Better cleanup logging from Rene Joergensen
 - Fix for Syslog.pm error messages at init time
 - Fix doc packaging in RPM

* Tue Jan 11 2005 Lionel Bouton <lionel-dev@bouton.name>
 - 1.4.1 release
 - fix for invalid group id messages from 
openSUSE Build Service is sponsored by