1c5be5
# Milter header files package name
6358fe
%if (0%{?rhel} && 0%{?rhel} <= 7) || (0%{?fedora} && 0%{?fedora} <= 25)
1c5be5
%global milter_devel_package sendmail-devel
6358fe
%else
6358fe
%global milter_devel_package sendmail-milter-devel
1c5be5
%endif
1c5be5
b3ba58
Name:		milter-regex
5e3260
Version:	2.4
5e3260
Release:	1%{?dist}
e7f0a3
Summary:	Milter plug-in for regular expression filtering
b3ba58
License:	BSD
0d96ee
URL:		http://www.benzedrine.ch/milter-regex.html
0d96ee
Source0:	http://www.benzedrine.ch/milter-regex-%{version}.tar.gz
e7f0a3
Source1:	milter-regex.service
b3ba58
Source2:	milter-regex-options
b3ba58
Source3:	milter-regex.conf
6358fe
BuildRequires:	byacc
6358fe
BuildRequires:	coreutils
6358fe
BuildRequires:	gcc
6358fe
BuildRequires:	groff
6358fe
BuildRequires:	make
1c5be5
BuildRequires:	%milter_devel_package >= 8.13
6358fe
BuildRequires:	sed
6358fe
BuildRequires:	systemd
0d96ee
Requires(pre):	shadow-utils
6358fe
%{?systemd_requires}
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
8f77fe
8f77fe
# Customize config file location and dæmon user
e7f0a3
sed -i -e	's|/etc/milter-regex\.conf|%{_sysconfdir}/mail/milter-regex.conf|;
e7f0a3
		 s|_milter-regex|mregex|' milter-regex.[8c]
8f77fe
8f77fe
# Copy out the license text from the source code
e7f0a3
head -n +31 milter-regex.c > LICENSE
174e58
174e58
%build
06e076
make %{?_smp_mflags} -f Makefile.linux CFLAGS="%{optflags} -Wextra -Wwrite-strings -DYYMAXDEPTH=8192"
174e58
174e58
%install
e7f0a3
mkdir -p \
e7f0a3
	%{buildroot}%{_unitdir} \
b3ba58
	%{buildroot}%{_localstatedir}/spool/milter-regex \
b3ba58
	%{buildroot}%{_mandir}/man8 \
b3ba58
	%{buildroot}%{_sbindir} \
b3ba58
	%{buildroot}%{_sysconfdir}/{mail,sysconfig}
e7f0a3
install -p -m 755 milter-regex %{buildroot}%{_sbindir}/
e7f0a3
install -p -m 644 milter-regex.8 %{buildroot}%{_mandir}/man8/
e7f0a3
install -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/milter-regex.service
e7f0a3
install -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/milter-regex
e7f0a3
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
6358fe
getent group mregex >/dev/null || groupadd -r mregex
6358fe
getent passwd mregex >/dev/null || \
6358fe
	useradd -r -g mregex -d %{_localstatedir}/spool/milter-regex \
b3ba58
		-s /sbin/nologin -c "Regex Milter" mregex
b3ba58
exit 0
174e58
174e58
%post
549e67
%systemd_post milter-regex.service
174e58
174e58
%preun
549e67
%systemd_preun milter-regex.service
174e58
174e58
%postun
549e67
%systemd_postun_with_restart milter-regex.service
174e58
174e58
%files
0301d1
%license LICENSE
174e58
%{_sbindir}/milter-regex
e7f0a3
%{_unitdir}/milter-regex.service
174e58
%config(noreplace) %{_sysconfdir}/sysconfig/milter-regex
174e58
%config(noreplace) %{_sysconfdir}/mail/milter-regex.conf
83fa82
%dir %attr(755,root,mregex) %{_localstatedir}/spool/milter-regex/
174e58
%ghost %{_localstatedir}/spool/milter-regex/sock
174e58
%{_mandir}/man8/milter-regex.8*
174e58
174e58
%changelog
5e3260
* Wed Apr  3 2019 Paul Howarth <paul@city-fan.org> - 2.4-1
5e3260
- Update to 2.4
5e3260
  - Bug fix: for actions followed by multiple expressions (not just one
5e3260
    arbitrarily complex expression), when multiple expressions become defined
5e3260
    during the same sequence point, but with different values (e.g. one true,
5e3260
    another false), depending on the expression order, the action might not be
5e3260
    taken, when it should be
5e3260
  - Add -f option to set syslog facility
5e3260
83fa82
* Sun Mar 24 2019 Paul Howarth <paul@city-fan.org> - 2.2-3
83fa82
- Fix ownership of /var/spool/milter-regex so that dac_override isn't needed
83fa82
  (#1678040)
83fa82
679ae3
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.2-2
679ae3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
679ae3
829e5e
* Fri Aug 24 2018 Paul Howarth <paul@city-fan.org> - 2.2-1
829e5e
- Update to 2.2
829e5e
  - Add -U, -G, and -P options to set pipe user, group, and permissions
829e5e
0d96ee
* Fri Aug 24 2018 Paul Howarth <paul@city-fan.org> - 2.1-1
0d96ee
- Update to 2.1
0d96ee
  - Default maximum log level to 6 (LOG_INFO), i.e. exclude LOG_DEBUG
0d96ee
- Upstream switched from benezedrine.cx to bezendrine.ch
0d96ee
ccecd4
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-13
ccecd4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
ccecd4
6a4e73
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-12
6a4e73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
6a4e73
6358fe
* Fri Jan 26 2018 Paul Howarth <paul@city-fan.org> - 2.0-11
6358fe
- Drop dependencies on systemd-units and use %%{?systemd_requires} instead
6358fe
- Use forward-looking conditionals
6358fe
- List build requirements one per line
6358fe
- Don't use full paths for commands in scriptlets, to improve readability
6358fe
- Drop legacy Group: tag
6358fe
f6e72f
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-10
f6e72f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
f6e72f
47e9d1
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-9
47e9d1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
47e9d1
5e4821
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-8
5e4821
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
5e4821
1c5be5
* Fri Aug  5 2016 Paul Howarth <paul@city-fan.org> - 2.0-7
1c5be5
- sendmail-devel renamed to sendmail-milter-devel from Fedora 26
1c5be5
- Specify all build requirements
1c5be5
ee714f
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0-6
ee714f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
ee714f
83ac26
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-5
83ac26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
83ac26
0301d1
* Mon Mar  2 2015 Paul Howarth <paul@city-fan.org> - 2.0-4
0301d1
- Use %%license
0301d1
4fc712
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-3
4fc712
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
4fc712
383dd2
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-2
383dd2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
383dd2
542bd1
* Mon Nov 25 2013 Paul Howarth <paul@city-fan.org> - 2.0-1
9d66dd
- Update to 2.0
9d66dd
  - Add -l option to specify maximum log level
9d66dd
- Drop upstreamed cleanup and starttls patches
542bd1
322ed7
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9-7
9d66dd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
322ed7
7b0ea8
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9-6
9d66dd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
7b0ea8
4c6777
* Fri Sep  7 2012 Paul Howarth <paul@city-fan.org> - 1.9-5
9d66dd
- Drop SysV-to-systemd migration support from F-18 onwards
9d66dd
- Use systemd scriptlet macros for preset support (#850207)
4c6777
829fca
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9-4
9d66dd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
829fca
8f77fe
* Tue Jul 17 2012 Paul Howarth <paul@city-fan.org> - 1.9-3
9d66dd
- Add support for STARTTLS macro checking (#840665)
9d66dd
- Defer dæmon startup until network is available
8f77fe
1513ba
* Fri Jan  6 2012 Paul Howarth <paul@city-fan.org> - 1.9-2
9d66dd
- Rebuilt for gcc 4.7
1513ba
06e076
* Tue Nov 22 2011 Paul Howarth <paul@city-fan.org> - 1.9-1
9d66dd
- Update to 1.9
9d66dd
  - Add -j option to chroot
9d66dd
  - Improve building on various platforms
9d66dd
  - Fix some typos in documentation and example config
9d66dd
- Drop upstreamed strlcat patch
9d66dd
- Drop gcc patch, no longer needed
9d66dd
- Build with additional warnings enabled, and add patch to fix warnings where
06e076
  possible (libmilter API is missing some 'const' attributes, so it's not
06e076
  possible to get rid of all of them)
06e076
41aad0
* Mon Jul 25 2011 Paul Howarth <paul@city-fan.org> - 1.8-4
41aad0
- Requires(post): systemd-sysv for sysv-to-systemd migration
41aad0
e7f0a3
* Sat Jul 16 2011 Paul Howarth <paul@city-fan.org> - 1.8-3
9d66dd
- Switch from SysV initscript to systemd unit file
9d66dd
- Clean up for modern rpmbuild
9d66dd
- Drop Sendmail references as the milter should work with Postfix too
9d66dd
- Nobody else likes macros for commands
e7f0a3
cdade1
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8-2
9d66dd
- 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
9d66dd
- Update to 1.8 (log symbolic host name together with numeric IP address)
9d66dd
- Add missing function strlcat from openbsd libc
9d66dd
- Fix %%postun to restart the milter properly on package upgrades
9d66dd
- 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
9d66dd
- 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
9d66dd
- 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
9d66dd
- Rebuild for shared libmilter in Fedora 11 development
e16af9
0a744b
* Mon Feb 18 2008 Paul Howarth <paul@city-fan.org> - 1.7-3
9d66dd
- Support config files with more than 507 rules (#304071)
0a744b
c9ffdc
* Wed Aug 22 2007 Paul Howarth <paul@city-fan.org> - 1.7-2
9d66dd
- 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
9d66dd
- Update to 1.7 (sendmail macro filtering support added)
9d66dd
- Tarball now includes a versioned directory name
9d66dd
- Split milter-regex.conf out from being a here document in the spec and have
b3ba58
  it as a separate source file instead
9d66dd
- Unexpand tabs 
9d66dd
- Use the standard scriptlet for user/group creation in %%pre
9d66dd
- Use %%{_initrddir} rather than %%{_sysconfdir}/rc.d/init.d for initscript
9d66dd
- Use %%{__install} rather than %%{__cp} in %%install
9d66dd
- 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
9d66dd
- Add patch for compile errors on Fedora 7
9d66dd
- Use sed rather than perl for quick scripted edits
2a0fd9
cbc38c
* Tue Aug 29 2006 Paul Howarth <paul@city-fan.org> - 1.6-6
9d66dd
- 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
9d66dd
- 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