b3ba58
Name:		milter-regex
bb31b4
Version:	1.8
8d6396
Release:	2.1%{?dist}
8d6396
Summary:	Milter plug-in for regular expression filtering
b3ba58
Group:		System Environment/Daemons
b3ba58
License:	BSD
b3ba58
URL:		http://www.benzedrine.cx/milter-regex.html
b3ba58
Source0:	http://www.benzedrine.cx/milter-regex-%{version}.tar.gz
b3ba58
Source1:	milter-regex-initscript
b3ba58
Source2:	milter-regex-options
b3ba58
Source3:	milter-regex.conf
b3ba58
Patch0:		milter-regex-1.6-gcc.patch
bb31b4
Patch1:		milter-regex-1.8-strlcat.patch
b3ba58
Buildrequires:	sendmail-devel >= 8.13, byacc, groff
bb31b4
b3ba58
Requires(pre):	  shadow-utils
b3ba58
Requires(post):	  /sbin/chkconfig
b3ba58
Requires(preun):  /sbin/chkconfig
174e58
174e58
%description
174e58
Milter-regex is a milter based filter that makes it possible to filter
174e58
emails using regular expressions.
174e58
174e58
%prep
b3ba58
%setup -q
2a0fd9
%patch0 -p1 -b .gcc
bb31b4
%patch1 -p0 -b .strlcat
8d6396
sed -i -e	's|/etc/milter-regex\.conf|%{_sysconfdir}/mail/milter-regex.conf|;
8d6396
		 s|_milter-regex|mregex|' milter-regex.[8c]
8d6396
head -n +31 milter-regex.c > LICENSE
174e58
174e58
%build
8d6396
make %{?_smp_mflags} -f Makefile.linux CFLAGS="%{optflags} -DYYMAXDEPTH=8192"
174e58
174e58
%install
8d6396
mkdir -p \
bb31b4
	%{buildroot}%{_initddir} \
b3ba58
	%{buildroot}%{_localstatedir}/spool/milter-regex \
b3ba58
	%{buildroot}%{_mandir}/man8 \
b3ba58
	%{buildroot}%{_sbindir} \
b3ba58
	%{buildroot}%{_sysconfdir}/{mail,sysconfig}
8d6396
install -p -m 755 milter-regex %{buildroot}%{_sbindir}/
8d6396
install -p -m 644 milter-regex.8 %{buildroot}%{_mandir}/man8/
8d6396
install -p -m 755 %{SOURCE1} %{buildroot}%{_initddir}/milter-regex
8d6396
install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/milter-regex
8d6396
install -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/mail/milter-regex.conf
174e58
174e58
# Create a ghost sock file so we can remove it on package deletion
174e58
: > %{buildroot}%{_localstatedir}/spool/milter-regex/sock
174e58
174e58
%pre
b3ba58
/usr/bin/getent group mregex >/dev/null || /usr/sbin/groupadd -r mregex
b3ba58
/usr/bin/getent passwd mregex >/dev/null || \
b3ba58
	/usr/sbin/useradd -r -g mregex -d %{_localstatedir}/spool/milter-regex \
b3ba58
		-s /sbin/nologin -c "Regex Milter" mregex
b3ba58
exit 0
174e58
174e58
%post
174e58
/sbin/chkconfig --add milter-regex || :
174e58
174e58
%preun
8d6396
if [ $1 -eq 0 ]; then
bb31b4
	%{_initddir}/milter-regex stop &> /dev/null || :
b3ba58
	/sbin/chkconfig --del milter-regex || :
174e58
fi
174e58
174e58
%postun
bb31b4
[ $1 -ge 1 ] && %{_initddir}/milter-regex try-restart &> /dev/null || :
174e58
174e58
%files
174e58
%doc LICENSE
174e58
%{_sbindir}/milter-regex
bb31b4
%{_initddir}/milter-regex
174e58
%config(noreplace) %{_sysconfdir}/sysconfig/milter-regex
174e58
%config(noreplace) %{_sysconfdir}/mail/milter-regex.conf
2a0fd9
%dir %attr(755,mregex,mregex) %{_localstatedir}/spool/milter-regex/
174e58
%ghost %{_localstatedir}/spool/milter-regex/sock
174e58
%{_mandir}/man8/milter-regex.8*
174e58
174e58
%changelog
8d6396
* Mon Sep  5 2011 Paul Howarth <paul@city-fan.org> - 1.8-2.1
8d6396
- clean up for modern rpmbuild
8d6396
- drop Sendmail references as the milter should work with Postfix too
8d6396
- nobody else likes macros for commands
8d6396
cdade1
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8-2
8d6396
- rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
cdade1
bb31b4
* Fri Aug 13 2010 Paul Howarth <paul@city-fan.org> - 1.8-1
bb31b4
- update to 1.8 (log symbolic host name together with numeric IP address)
bb31b4
- add missing function strlcat from openbsd libc
bb31b4
- fix %%postun to restart the milter properly on package upgrades
bb31b4
- use %%{_initddir} rather than the deprecated %%{_initrddir} where possible
bb31b4
46de78
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7-6
bb31b4
- rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
46de78
194749
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7-5
bb31b4
- rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
194749
e16af9
* Fri Feb 13 2009 Paul Howarth <paul@city-fan.org> - 1.7-4
bb31b4
- rebuild for shared libmilter in Fedora 11 development
e16af9
0a744b
* Mon Feb 18 2008 Paul Howarth <paul@city-fan.org> - 1.7-3
0a744b
- support config files with more than 507 rules (#304071)
0a744b
c9ffdc
* Wed Aug 22 2007 Paul Howarth <paul@city-fan.org> - 1.7-2
c9ffdc
- rebuild for BuildID inclusion
c9ffdc
  (http://fedoraproject.org/wiki/Releases/FeatureBuildId)
c9ffdc
b3ba58
* Mon Aug  6 2007 Paul Howarth <paul@city-fan.org> - 1.7-1
b3ba58
- update to 1.7 (sendmail macro filtering support added)
b3ba58
- tarball now includes a versioned directory name
b3ba58
- split milter-regex.conf out from being a here document in the spec and have
b3ba58
  it as a separate source file instead
b3ba58
- unexpand tabs 
b3ba58
- use the standard scriptlet for user/group creation in %%pre
b3ba58
- use %%{_initrddir} rather than %%{_sysconfdir}/rc.d/init.d for initscript
b3ba58
- use %%{__install} rather than %%{__cp} in %%install
b3ba58
- drop scriptlet dependencies on /sbin/service by calling initscript directly
b3ba58
- LSB-ize initscript (#246983)
b3ba58
2a0fd9
* Wed Apr 18 2007 Paul Howarth <paul@city-fan.org> - 1.6-7
2a0fd9
- add patch for compile errors on Fedora 7
2a0fd9
- use sed rather than perl for quick scripted edits
2a0fd9
cbc38c
* Tue Aug 29 2006 Paul Howarth <paul@city-fan.org> - 1.6-6
cbc38c
- rebuild for dynamic linking speedups (FE6)
cbc38c
174e58
* Thu May 25 2006 Paul Howarth <paul@city-fan.org> - 1.6-5
174e58
- Address issues raised in review (#189611)
b3ba58
  - Add sendmail dependency
b3ba58
  - Honor %%{optflags}
174e58
174e58
* Fri Apr 21 2006 Paul Howarth <paul@city-fan.org> - 1.6-4
174e58
- Minor cosmetic changes for resubmission for Fedora Extras
174e58
174e58
* Fri Nov 18 2005 Paul Howarth <paul@city-fan.org> - 1.6-3
174e58
- Remove redundant ver_ and rel_ macros
174e58
- Don't include package name in the summary
174e58
- Use macros consistently
174e58
- Generate LICENSE file in %%prep rather than %%install
174e58
- Don't strip binary, so debuginfo package is useful
174e58
- Combine groupadd+useradd into a single useradd command
174e58
- Use /sbin/nologin for mregex shell instead of non-existent /bin/nologin
174e58
- Don't delete user+group on package removal (see
174e58
  http://www.redhat.com/archives/fedora-extras-commits/2005-June/msg00271.html)
174e58
- Install initscript in %%{_sysconfdir} rather than /etc/init.d
174e58
- Don't enable service by default on installation
174e58
- Add scriptlet dependencies
174e58
- Add buildreq groff
174e58
- Use full URL for source
174e58
- Edit username in man page as well as in code
174e58
- Use install rather than cp to install %%{SOURCE1} and %%{SOURCE2} so
174e58
  that permissions don't need to be set in SRPM
174e58
- Ghost the socket for clean package removal
174e58
- Buildreq sendmail-devel >= 8.13.0 because of the use of SMFIF_QUARANTINE
174e58
- Use dist tag
174e58
174e58
* Tue Jan 25 2005 Victor Ramirez <vramirez@gmail.com> - 1.6-2 
174e58
- Initial rpm release
174e58
- Modified user and configuration file location.
174e58