diff --git a/.cvsignore b/.cvsignore index e69de29..a075e47 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +milter-regex-1.6.tar.gz diff --git a/milter-regex-initscript b/milter-regex-initscript new file mode 100644 index 0000000..1caffb2 --- /dev/null +++ b/milter-regex-initscript @@ -0,0 +1,68 @@ +#!/bin/sh +# +# Startup script for milter-regex +# +# chkconfig: - 75 40 +# description: Allows sendmail to filter mail using regular expressions +# processname: milter-regex +# config: /etc/mail/milter-regex.conf /etc/sysconfig/milter-regex + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source options file +[ -f /etc/sysconfig/milter-regex ] && . /etc/sysconfig/milter-regex + +[ -f /usr/sbin/milter-regex ] || exit 0 + +prog="milter-regex" + +start() { + echo -n $"Starting $prog: " + daemon $prog $OPTIONS + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/milter-regex + echo + return $RETVAL +} + +stop() { + if test "x`pidof milter-regex`" != x; then + echo -n $"Stopping $prog: " + killproc milter-regex + echo + fi + RETVAL=$? + rm -f /var/lock/subsys/milter-regex + return $RETVAL +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + + status) + status milter-regex + ;; + restart) + stop + start + ;; + condrestart|reload) + if test "x`pidof milter-regex`" != x; then + stop + start + fi + ;; + + *) + echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}" + exit 1 + +esac + +exit $RETVAL diff --git a/milter-regex-options b/milter-regex-options new file mode 100644 index 0000000..895c825 --- /dev/null +++ b/milter-regex-options @@ -0,0 +1,7 @@ +# -c configfile -u user -p fifo_file +# Defaults +# configfile: /etc/mail/milter-regex.conf +# user: mregex +# fifo: /var/spool/milter-regex/sock + +OPTIONS= diff --git a/milter-regex.spec b/milter-regex.spec new file mode 100644 index 0000000..2cb76c2 --- /dev/null +++ b/milter-regex.spec @@ -0,0 +1,117 @@ +Name: milter-regex +Version: 1.6 +Release: 5%{?dist} +Summary: Sendmail milter plugin for regular expression filtering +Group: System Environment/Daemons +License: BSD +URL: http://www.benzedrine.cx/milter-regex.html +Source0: http://www.benzedrine.cx/milter-regex-%{version}.tar.gz +Source1: milter-regex-initscript +Source2: milter-regex-options +Buildroot: %{_tmppath}/%{name}-%{release}-root-%(%{__id_u} -n) +Buildrequires: sendmail-devel >= 8.13, byacc, groff +Requires: sendmail + +Requires(pre): /usr/sbin/useradd +Requires(post): /usr/sbin/useradd +Requires(preun): /sbin/chkconfig, /sbin/service +Requires(postun): /sbin/service + +%description +Milter-regex is a milter based filter that makes it possible to filter +emails using regular expressions. + +%prep +%setup -q -n %{name} +%{__perl} -pi -e 's+/etc/milter-regex\.conf+%{_sysconfdir}/mail/milter-regex.conf+' milter-regex.[8c] +%{__perl} -pi -e 's+_milter-regex+mregex+' milter-regex.[8c] +/usr/bin/head -n +31 milter-regex.c > LICENSE + +%build +%{__make} %{?_smp_mflags} -f Makefile.linux CFLAGS="%{optflags}" + +%install +%{__rm} -rf %{buildroot} +%{__mkdir} -p %{buildroot}%{_sbindir} \ + %{buildroot}%{_sysconfdir}/{rc.d/init.d,mail,sysconfig} \ + %{buildroot}%{_mandir}/man8 \ + %{buildroot}%{_localstatedir}/spool/milter-regex +%{__cp} -p milter-regex %{buildroot}%{_sbindir} +%{__cp} -p milter-regex.8 %{buildroot}%{_mandir}/man8 +%{__install} -p -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/rc.d/init.d/milter-regex +%{__install} -p -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/milter-regex + +%{__cat} > %{buildroot}%{_sysconfdir}/mail/milter-regex.conf << EOF +# Insert here Your milter-regex rules. +# See manpage milter-regex for details. +# You don't need to reload config; milter-regex reloads it when it changes. + +EOF + +# Create a ghost sock file so we can remove it on package deletion +: > %{buildroot}%{_localstatedir}/spool/milter-regex/sock + +%pre +/usr/sbin/useradd -r -M -d / -s /sbin/nologin -c "Regex Milter" mregex &> /dev/null || : + +%post +/sbin/chkconfig --add milter-regex || : + +%preun +if [ $1 -eq 0 ] ; then + /sbin/service milter-regex stop &> /dev/null || : + /sbin/chkconfig --del milter-regex || : +fi + +%postun +[ $1 -eq 0 ] && /sbin/service milter-regexp condrestart &> /dev/null || : + +%clean +%{__rm} -rf %{buildroot} + +%files +%defattr(-,root,root) +%doc LICENSE +%{_sbindir}/milter-regex +%{_sysconfdir}/rc.d/init.d/milter-regex +%config(noreplace) %{_sysconfdir}/sysconfig/milter-regex +%config(noreplace) %{_sysconfdir}/mail/milter-regex.conf +%dir %attr(755,mregex,mregex) %{_localstatedir}/spool/milter-regex +%ghost %{_localstatedir}/spool/milter-regex/sock +%{_mandir}/man8/milter-regex.8* + +%changelog +* Thu May 25 2006 Paul Howarth - 1.6-5 +- Address issues raised in review (#189611) +- Add sendmail dependency +- Honor %%{optflags} + +* Fri Apr 21 2006 Paul Howarth - 1.6-4 +- Minor cosmetic changes for resubmission for Fedora Extras + +* Fri Nov 18 2005 Paul Howarth - 1.6-3 +- Remove redundant ver_ and rel_ macros +- Don't include package name in the summary +- Use macros consistently +- Generate LICENSE file in %%prep rather than %%install +- Don't strip binary, so debuginfo package is useful +- Combine groupadd+useradd into a single useradd command +- Use /sbin/nologin for mregex shell instead of non-existent /bin/nologin +- Don't delete user+group on package removal (see + http://www.redhat.com/archives/fedora-extras-commits/2005-June/msg00271.html) +- Install initscript in %%{_sysconfdir} rather than /etc/init.d +- Don't enable service by default on installation +- Add scriptlet dependencies +- Add buildreq groff +- Use full URL for source +- Edit username in man page as well as in code +- Use install rather than cp to install %%{SOURCE1} and %%{SOURCE2} so + that permissions don't need to be set in SRPM +- Ghost the socket for clean package removal +- Buildreq sendmail-devel >= 8.13.0 because of the use of SMFIF_QUARANTINE +- Use dist tag + +* Tue Jan 25 2005 Victor Ramirez - 1.6-2 +- Initial rpm release +- Modified user and configuration file location. + diff --git a/sources b/sources index e69de29..c237683 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +6b5dbc79b0c78cf186f9a19f8d4e3889 milter-regex-1.6.tar.gz