[packages/opendmarc] pldize scriptlets, fix initscript install

glen glen at pld-linux.org
Thu May 29 11:53:30 CEST 2014


commit 5d5556573ef040263dd699bd72713dc0f60f5fa4
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu May 29 12:53:06 2014 +0300

    pldize scriptlets, fix initscript install

 opendmarc.spec | 48 ++++++++++++++++++++----------------------------
 1 file changed, 20 insertions(+), 28 deletions(-)
---
diff --git a/opendmarc.spec b/opendmarc.spec
index 794ecbc..867829e 100644
--- a/opendmarc.spec
+++ b/opendmarc.spec
@@ -1,18 +1,20 @@
+# TODO
+# - pld useradd/groupadd and register uid/gid
 Summary:	DMARC milter and library
 Name:		opendmarc
 Version:	1.2.0
 Release:	0.1
 License:	BSD
 Group:		Daemons
-Source0:        http://downloads.sourceforge.net/opendmarc/%{name}-%{version}.tar.gz
+Source0:	http://downloads.sourceforge.net/opendmarc/%{name}-%{version}.tar.gz
 # Source0-md5:	bad2c454841cf7711fc148e114620051
 URL:		http://www.trusteddomain.org/opendmarc.html
-Requires:	lib%{name} = %{version}-%{release}
+BuildRequires:	libtool
 BuildRequires:	mysql-devel
-BuildRequires:	sendmail-devel
 BuildRequires:	openssl-devel
-BuildRequires:	libtool
 BuildRequires:	pkgconfig
+BuildRequires:	sendmail-devel
+Requires:	libopendmarc = %{version}-%{release}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -51,13 +53,12 @@ files required for developing applications against libopendmarc.
 
 %install
 rm -rf $RPM_BUILD_ROOT
-
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
 install -d $RPM_BUILD_ROOT%{_sysconfdir}
-install -d $RPM_BUILD_ROOT%{_initrddir}
-cp -p contrib/init/redhat/%{name} $RPM_BUILD_ROOT%{_initrddir}/%{name}
+install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
+install -p contrib/init/redhat/%{name} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
 cp -p opendmarc/%{name}.conf.sample $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
 # Set some basic settings in the default config file
 perl -pi -e 's|^# (HistoryFile /var/run)/(opendmarc.dat)|$1/opendmarc/$2/;
@@ -70,53 +71,44 @@ cat > $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf <<EOF
 D %{_localstatedir}/run/%{name} 0700 %{name} %{name} -
 EOF
 
-mv $RPM_BUILD_ROOT%{_datadir}/doc/%{name} $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}
+mv $RPM_BUILD_ROOT%{_docdir}/%{name} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
 rm $RPM_BUILD_ROOT%{_libdir}/*.{la,a}
 
 install -d $RPM_BUILD_ROOT%{_includedir}/%{name}
-cp -p libopendmarc/dmarc.h $RPM_BUILD_ROOT%{_includedir}/%{name}/
+cp -p libopendmarc/dmarc.h $RPM_BUILD_ROOT%{_includedir}/%{name}
 
 install -d $RPM_BUILD_ROOT%{_localstatedir}/spool/%{name}
 install -d $RPM_BUILD_ROOT%{_localstatedir}/run/%{name}
 
+%clean
+rm -rf $RPM_BUILD_ROOT
 
 %pre
 getent group %{name} >/dev/null || groupadd -r %{name}
 getent passwd %{name} >/dev/null || \
 	useradd -r -g %{name} -G mail -d %{_localstatedir}/run/%{name} -s /sbin/nologin \
 	-c "OpenDMARC Milter" %{name}
-exit 0
 
 %post
-/sbin/chkconfig --add %{name} || :
+/sbin/chkconfig --add %{name}
+%service %{name} restart
 
 %preun
 if [ $1 -eq 0 ]; then
-	service %{name} stop >/dev/null || :
-	/sbin/chkconfig --del %{name} || :
-fi
-exit 0
-
-%postun
-if [ "$1" -ge "1" ] ; then
-	%service %{name} condrestart >/dev/null 2>&1 || :
+	/sbin/chkconfig --del %{name}
+	%service %{name} stop
 fi
-exit 0
-
-%post -n libopendmarc -p /sbin/ldconfig
-%postun -n libopendmarc -p /sbin/ldconfig
 
-
-%clean
-rm -rf $RPM_BUILD_ROOT
+%post	-n libopendmarc -p /sbin/ldconfig
+%postun	-n libopendmarc -p /sbin/ldconfig
 
 %files
 %defattr(644,root,root,755)
-%doc INSTALL README RELEASE_NOTES docs/draft-dmarc-base-00-02.txt
+%doc INSTALL README RELEASE_NOTES docs/draft-dmarc-base-02.txt
 %doc db/README.schema db/schema.mysql
 %config(noreplace) %{_sysconfdir}/%{name}.conf
 %config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
-%{_initrddir}/%{name}
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
 %attr(755,root,root) %{_sbindir}/*
 %{_mandir}/*/*
 %dir %attr(-,%{name},%{name}) %{_localstatedir}/spool/%{name}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/opendmarc.git/commitdiff/17315415705db4827720ae6875d2c26ba2b92206



More information about the pld-cvs-commit mailing list