[mt-daapd] fix systemd scriptlets

Tom Callaway spot at fedoraproject.org
Fri Sep 9 15:50:03 UTC 2011


commit 2c63f7bf3e6add7be49d0a0049bca3a2f54355c8
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Fri Sep 9 11:49:51 2011 -0400

    fix systemd scriptlets

 mt-daapd.spec |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/mt-daapd.spec b/mt-daapd.spec
index e77bd86..b010d8e 100644
--- a/mt-daapd.spec
+++ b/mt-daapd.spec
@@ -11,7 +11,7 @@ Summary: An iTunes-compatible media server
 Name: mt-daapd
 Epoch: 1
 Version: 0.2.4.2
-Release: 9%{?dist}
+Release: 10%{?dist}
 License: GPLv2+
 Group: Applications/Multimedia
 Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
@@ -26,6 +26,10 @@ BuildRequires: libid3tag-devel, sqlite-devel
 BuildRequires: systemd-units
 Requires(pre):   /usr/sbin/useradd
 Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+
 Provides: group(%username) = %uid
 Provides: user(%username) = %uid
 
@@ -56,15 +60,27 @@ install -m 0640 contrib/mt-daapd.conf %{buildroot}%{_sysconfdir}/
 %__fe_groupadd %uid -r %username &>/dev/null || :
 %__fe_useradd  %uid -r -s /sbin/nologin -d %homedir -M -c '%gecos' -g %username %username &>/dev/null || :
 
+%post
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
 %preun
-if [ $1 = 0 ]; then
-        /sbin/service mt-daapd stop >/dev/null 2>&1
-	/sbin/chkconfig --del mt-daapd
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable mt-daapd.service > /dev/null 2>&1 || :
+    /bin/systemctl stop mt-daapd.service > /dev/null 2>&1 || :
 fi
 
 %postun
 %__fe_userdel  %username &>/dev/null || :
 %__fe_groupdel %username &>/dev/null || :
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart mt-daapd.service >/dev/null 2>&1 || :
+fi
 
 %triggerun -- mt-daapd < 0.2.4.2-9
 # Save the current service runlevel info
@@ -85,6 +101,9 @@ fi
 %doc AUTHORS COPYING CREDITS NEWS README TODO
 
 %changelog
+* Fri Sep 09 2011 Tom Callaway <spot at fedoraproject.org> - 1:0.2.4.2-10
+- fix systemd scriptlets
+
 * Thu Sep 08 2011 Tom Callaway <spot at fedoraproject.org> - 1:0.2.4.2-9
 - convert to systemd
 


More information about the scm-commits mailing list