[rtpproxy] Fixed systemd installation

Peter Lemenkov peter at fedoraproject.org
Fri Apr 27 12:12:23 UTC 2012


commit dade566cebc7fe4da30fffea6002cccb66a66f41
Author: Peter Lemenkov <lemenkov at gmail.com>
Date:   Fri Apr 27 16:12:14 2012 +0400

    Fixed systemd installation
    
    Signed-off-by: Peter Lemenkov <lemenkov at gmail.com>

 rtpproxy.service |    3 +++
 rtpproxy.spec    |   29 ++++++++++++++++++++++++-----
 2 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/rtpproxy.service b/rtpproxy.service
index ab67334..92a0805 100644
--- a/rtpproxy.service
+++ b/rtpproxy.service
@@ -9,3 +9,6 @@ Group=rtpproxy
 EnvironmentFile=/etc/sysconfig/rtpproxy
 PIDFile=/var/run/rtpproxy/rtpproxy.pid
 ExecStart=/usr/bin/rtpproxy -f -p /var/run/rtpproxy/rtpproxy.pid $OPTIONS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/rtpproxy.spec b/rtpproxy.spec
index 5756446..2e0bc62 100644
--- a/rtpproxy.spec
+++ b/rtpproxy.spec
@@ -1,6 +1,6 @@
 Name:           rtpproxy
 Version:        1.2.1
-Release:        6%{?dist}
+Release:        7%{?dist}
 Summary:        A symmetric RTP proxy
 Group:          Applications/Internet
 License:        BSD
@@ -8,10 +8,10 @@ URL:            http://www.rtpproxy.org
 Source0:        http://b2bua.org/chrome/site/%{name}-%{version}.tar.gz
 Source1:        rtpproxy.sysconfig
 Source2:	rtpproxy.init
-%if 0%{?fc15}%{?fc16}%{?fc17}
 # systemd stuff
 Source3:	rtpproxy.service
 Source4:	rtpproxy.tmpfiles.conf
+%if 0%{?fedora} > 14
 BuildRequires:	systemd-units
 %endif
 # See https://bugzilla.redhat.com/626863
@@ -43,7 +43,7 @@ make %{?_smp_mflags}
 rm -rf %{buildroot}
 make install DESTDIR=%{buildroot}
 install -D -p -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
-%if 0%{?fc15}%{?fc16}%{?fc17}
+%if 0%{?fedora} > 14
 # install systemd files
 install -D -m 0644 -p %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
 install -D -m 0644 -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
@@ -59,26 +59,42 @@ install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}
 rm -rf %{buildroot}
 
 %pre
+getent passwd %{name} >/dev/null || \
 /usr/sbin/useradd -r -c "RTPProxy service"  -d %{_localstatedir}/lib/%{name} -s /sbin/nologin %{name} 2>/dev/null || :
 
 %post
+%if 0%{?fedora} > 14
+if [ $1 -eq 1 ] ; then
+    # Initial installation
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+%else
 if [ $1 -eq 1 ]; then
-	/sbin/chkconfig  --add %{name} || :
+	/sbin/chkconfig --add s%{name} || :
 fi
+%endif
 
 
 %preun
+%if 0%{?fedora} > 14
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
+    /bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
+fi
+%else
 if [ $1 -eq 0 ]; then
 	/sbin/service %{name} stop >/dev/null 2>&1 || :
 	/sbin/chkconfig --del %{name} || :
 fi
+%endif
 
 
 %files
 %defattr(-,root,root,-)
 %doc AUTHORS COPYING README README.remote
 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
-%if 0%{?fc15}%{?fc16}%{?fc17}
+%if 0%{?fedora} > 14
 %{_unitdir}/%{name}.service
 %{_sysconfdir}/tmpfiles.d/%{name}.conf
 %dir %attr(0755, rtpproxy, rtpproxy) %{_localstatedir}/run/%{name}
@@ -92,6 +108,9 @@ fi
 
 
 %changelog
+* Fri Apr 27 2012 Peter Lemenkov <lemenkov at gmail.com> - 1.2.1-7
+- Fixed systemd installation
+
 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.2.1-6
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list