diff options
-rw-r--r-- | opendkim.spec | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/opendkim.spec b/opendkim.spec index 70c248f..364f8de 100644 --- a/opendkim.spec +++ b/opendkim.spec @@ -12,7 +12,8 @@ Group: System Environment/Daemons Requires: lib%{name} = %{version}-%{release} Requires (pre): shadow-utils -%if is_systemd +%if %is_systemd +# Required for systemd Requires (post): systemd-units Requires (preun): systemd-units Requires (postun): systemd-units @@ -35,7 +36,13 @@ BuildRequires: sendmail-devel Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz +%if %is_systemd +# Define systemd patches +#Patch0: %{name}.patchname.patch +%else +# Define SysV patches Patch0: %{name}.init.patch +%endif BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -64,12 +71,12 @@ required for developing applications against libopendkim. %prep %setup -q -%patch0 -p1 - -%if is_systemd -echo "systemd YES!" +%if %is_systemd +# Apply systemd patches +#%patch0 -p1 %else -echo "systemd NO!" +# Apply SysV patches +%patch0 -p1 %endif %build @@ -77,7 +84,7 @@ echo "systemd NO!" # properly handle 32 versus 64 bit detection and settings %define LIBTOOL LIBTOOL=`which libtool` -%if is_systemd +%if %is_systemd %configure --with-libmemcached --with-db %else %configure --with-db @@ -95,7 +102,7 @@ install -d %{buildroot}%{_sysconfdir} install -d %{buildroot}%{_sysconfdir}/sysconfig install -m 0755 contrib/init/redhat/%{name}-default-keygen %{buildroot}%{_sbindir}/%{name}-default-keygen -%if is_systemd +%if %is_systemd install -d -m 0755 %{buildroot}%{_unitdir} install -m 0644 contrib/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service %else @@ -357,7 +364,7 @@ getent passwd %{name} >/dev/null || \ exit 0 %post -%if is_systemd +%if %is_systemd if [ $1 -eq 1 ] ; then # Initial installation /bin/systemctl enable %{name}.service >/dev/null 2>&1 || : @@ -369,7 +376,7 @@ fi %endif %preun -%if is_systemd +%if %is_systemd if [ $1 -eq 0 ] ; then # Package removal, not upgrade /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || : @@ -386,7 +393,7 @@ exit 0 %endif %postun -%if is_systemd +%if %is_systemd /bin/systemctl daemon-reload >/dev/null 2>&1 || : if [ $1 -ge 1 ] ; then # Package upgrade, not uninstall @@ -401,7 +408,7 @@ fi exit 0 %endif -%if is_systemd +%if %is_systemd %triggerun -- %{name} < 2.8.0-1 /bin/systemctl enable %{name}.service >/dev/null 2>&1 /sbin/chkconfig --del %{name} >/dev/null 2>&1 || : |