diff dnsbl.spec.in @ 112:96b2eb7f25f5

move to autoconf/automake/docbook
author carl
date Sun, 18 Dec 2005 16:56:38 -0800
parents d9c64bafbf60
children a893afee4b80
line wrap: on
line diff
--- a/dnsbl.spec.in	Sun Dec 18 15:16:25 2005 -0800
+++ b/dnsbl.spec.in	Sun Dec 18 16:56:38 2005 -0800
@@ -1,11 +1,16 @@
-Summary: DNSBL Sendmail Milter
-Name: dnsbl
-Version: 5.10
-Release: 2
+%define localstatedir   /var/lib
+
+Summary:            @PACKAGE@ Sendmail Milter
+Name:               @PACKAGE@
+Version:            @VERSION@
+Release:            %{?custom_release}%{!?custom_release:1}
 Copyright: GPL
 Group: System Environment/Daemons
-Source: http://www.five-ten-sg.com/util/dnsbl.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}
+Source:             http://www.five-ten-sg.com/@PACKAGE@/packages/@PACKAGE@-@VERSION@.tar.gz
+BuildRoot:          %{_tmppath}/%{name}-%{version}-buildroot
+URL:                http://www.five-ten-sg.com/@PACKAGE@/
+Vendor:             510 Software Group
+Packager:           510 Software Group
 
 Requires(pre):  /usr/sbin/groupadd
 Requires(pre):  /usr/sbin/useradd
@@ -30,68 +35,53 @@
 %setup
 
 %build
-pwd
-g++ -c $CXXFLAGS -pthread dnsbl.cpp
-g++ -o dnsbl dnsbl.o /usr/lib/libresolv.a -lmilter -pthread
+./configure --prefix=%{_prefix} \
+    --bindir=%{_bindir} --mandir=%{_mandir} \
+    --localstatedir=%{localstatedir} --libdir=%{_libdir} \
+    --datadir=%{_datadir} --includedir=%{_includedir} \
+    --sysconfdir=%{_sysconfdir}
+make
+
 
 %install
-DST=%{buildroot}
-if [ "%{buildroot}" = "/" -o -z "%{buildroot}" ] ; then
-        echo sorry, you probably do not want me to delete the old buildroot at %{buildroot}
+if [ "$RPM_BUILD_ROOT" = "/" -o -z "$RPM_BUILD_ROOT" ] ; then
+        echo sorry, you probably do not want me to delete the old buildroot at $RPM_BUILD_ROOT
         exit 1
 fi
-
-rm -rf %{buildroot}
-mkdir -p %{buildroot}/etc/dnsbl
+rm -rf $RPM_BUILD_ROOT
+make prefix=$RPM_BUILD_ROOT%{_prefix} bindir=$RPM_BUILD_ROOT%{_bindir} \
+    mandir=$RPM_BUILD_ROOT%{_mandir} libdir=$RPM_BUILD_ROOT%{_libdir} \
+    localstatedir=$RPM_BUILD_ROOT%{localstatedir} \
+    datadir=$RPM_BUILD_ROOT%{_datadir} \
+    includedir=$RPM_BUILD_ROOT%{_includedir} \
+    sysconfdir=$RPM_BUILD_ROOT%{_sysconfdir} install
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/@PACKAGE@-@VERSION@
+mv -f $RPM_BUILD_ROOT%{_sysconfdir}/dnsbl/dnsbl      $RPM_BUILD_ROOT/etc/rc.d/init.d
+mv AUTHORS COPYING ChangeLog NEWS README             $RPM_BUILD_ROOT%{_datadir}/doc/@PACKAGE@-@VERSION@
+mkdir -p %{buildroot}/var/run/@PACKAGE@
 
-install -m 644 dnsbl.conf %{buildroot}/etc/dnsbl/dnsbl.conf
-install -m 644 hosts-ignore.conf %{buildroot}/etc/dnsbl/hosts-ignore.conf
-install -m 644 html-tags.conf %{buildroot}/etc/dnsbl/html-tags.conf
-install -m 644 tld.conf %{buildroot}/etc/dnsbl/tld.conf
-install -m 644 sample.conf %{buildroot}/etc/dnsbl/sample.conf
-
-mkdir -p %{buildroot}/usr/sbin
-install -m 755 dnsbl %{buildroot}/usr/sbin/dnsbl
-
-mkdir -p %{buildroot}/etc/rc.d/init.d
-install -m 755 dnsbl.rc %{buildroot}/etc/rc.d/init.d/dnsbl
-
-mkdir -p %{buildroot}/var/run/dnsbl
 
 %pre
 /usr/bin/getent passwd dnsbl ||
   useradd -r -d /etc/dnsbl -M -c "dnsbl pseudo-user" -s /sbin/nologin dnsbl
 
-#[JOG] Attempt to migrate an existing, non-rpm install.
-#      WARNING! This may cause blindness, loss of appetite, and a general
-#      feeling of ill will towards the author of this script. Please refer
-#      to the Licence file for warranty information...
-if [ -f "/var/dnsbl/dnsbl.conf" -a ! -f "/etc/dnsbl/dnsbl.conf" ] ; then
-        echo Existing installation found at /var/dnsbl/ Migrating configuation...
-        # create the conf directory so rpm can find it in a minute...
-        mkdir /etc/dnsbl/
-        # and try to copy all of the relavent config files that are below this directory
-        cd /var/dnsbl/
-        grep '^include ' /var/dnsbl/dnsbl.conf  | cut -d ' ' -f 2 | grep -v '^/' | xargs cp --target-directory=/etc/dnsbl/ /var/dnsbl/dnsbl.conf
-fi
-
 
 %post
-/sbin/chkconfig --add dnsbl
+/sbin/chkconfig --add @PACKAGE@
 /sbin/chkconfig dnsbl on
 /sbin/service dnsbl start
 
-echo Remember to edit /etc/dnsbl.conf and add the following line to your sendmail.mc:
+echo Remember to edit %{_sysconfdir}/@PACKAGE@/@PACKAGE@.conf and add the following line to your sendmail.mc:
 echo "INPUT_MAIL_FILTER(\`dnsbl\', \`S=local:/var/run/dnsbl/dnsbl.sock, F=T, T=C:30s;S:5m;R:5m;E:5m\')"
 echo
 
 
 %preun
-if [ $1 -eq 0 ]; then
-   /sbin/service dnsbl stop || :
-   /sbin/chkconfig --del dnsbl
-   userdel dnsbl || :
-fi
+/sbin/service @PACKAGE@ stop || :
+/sbin/chkconfig --del @PACKAGE@
+userdel @PACKAGE@ || :
+
 
 %postun
 
@@ -99,13 +89,20 @@
 
 %files
 %defattr(-,root,root)
-%config(noreplace) /etc/dnsbl/
-%doc RELEASE_NOTES LICENSE sample.conf test.cpp
-/etc/rc.d/init.d/dnsbl
-/usr/sbin/dnsbl
-%dir %attr(0750,dnsbl,root) /var/run/dnsbl
+%{_sbindir}/*
+%doc %{_mandir}/*
+%docdir %{_datadir}/doc/@PACKAGE@-@VERSION@
+%{_datadir}/doc/@PACKAGE@-@VERSION@
+%config(noreplace) %{_sysconfdir}/@PACKAGE@
+%config(noreplace) %{_sysconfdir}/@PACKAGE@/*.conf
+/etc/rc.d/init.d/@PACKAGE@
+%dir %attr(0750,@PACKAGE@,root) /var/run/@PACKAGE@
+
 
 %changelog
+* Sun Dec 18 2005 Carl Byington 1.0
+- use autoconf and http://www.fedora.us/docs/rpm-packaging-guidelines.html
+
 * Tue Jan 03 2005 Carl Byington 1.4
 - added hosts-ignore conf file
 - see RELEASE_NOTES