[sphinx] use systemd macros

Christof Damian cdamian at fedoraproject.org
Sat Apr 20 20:40:35 UTC 2013


commit 2ba893b85296c60857a065c033c07eec86721ea1
Author: Christof Damian <christof at damian.net>
Date:   Sat Apr 20 22:29:56 2013 +0200

    use systemd macros

 sphinx.spec |   34 +++++++---------------------------
 1 files changed, 7 insertions(+), 27 deletions(-)
---
diff --git a/sphinx.spec b/sphinx.spec
index 89b889d..c357119 100644
--- a/sphinx.spec
+++ b/sphinx.spec
@@ -25,9 +25,9 @@ BuildRequires:  expat-devel
 BuildRequires:  dos2unix
 #Requires:
 
-Requires(post): systemd-units
-Requires(preun): systemd-units
-Requires(postun): systemd-units
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
 
 # Users and groups
 Requires(pre): shadow-utils
@@ -141,8 +141,6 @@ install -p -D -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/searchd.service
 
 # Create /var/log/sphinx
 mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/sphinx
-touch $RPM_BUILD_ROOT%{_localstatedir}/log/sphinx/searchd.log
-touch $RPM_BUILD_ROOT%{_localstatedir}/log/sphinx/query.log
 
 # Create /var/run/sphinx
 mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/sphinx
@@ -227,34 +225,15 @@ useradd -r -g %{sphinx_group} -d %{sphinx_home} -s /bin/bash \
 exit 0
 
 %post
-#/sbin/chkconfig --add searchd
-if [ $1 -eq 1 ] ; then 
-    # Initial installation 
-    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
-
+%systemd_post searchd.service
 
 %preun
-#if [ $1 = 0 ] ; then
-#    /sbin/service searchd stop >/dev/null 2>&1
-#    /sbin/chkconfig --del searchd
-#fi
-if [ $1 -eq 0 ] ; then
-    # Package removal, not upgrade
-    /bin/systemctl --no-reload disable searchd.service > /dev/null 2>&1 || :
-    /bin/systemctl stop searchd.service > /dev/null 2>&1 || :
-fi
-
+%systemd_preun searchd.service
 
 %post -p /sbin/ldconfig -n libsphinxclient
 
 %postun 
-/sbin/ldconfig -n libsphinxclient
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
-    # Package upgrade, not uninstall
-    /bin/systemctl try-restart searchd.service >/dev/null 2>&1 || :
-fi
+%systemd_postun_with_restart searchd.service
 
 
 %posttrans
@@ -316,6 +295,7 @@ chown -R %{sphinx_user}:root %{_localstatedir}/lib/sphinx/
 - upstream 2.0.7
 - use tmpfiles.d to create pid directory
 - move default log file location to /var/log/sphinx
+- use systemd macros BZ 850323
 
 * Wed Mar  6 2013 Michel Salim <salimma at fedoraproject.org> - 2.0.6-1
 - Update to 2.0.6


More information about the scm-commits mailing list