[mt-st] switch to systemd scriptlet macros

Dan Horák sharkcz at fedoraproject.org
Tue Jul 23 10:30:19 UTC 2013


commit da8e67d6b9dabb9f0c090b1375616ec800424930
Author: Dan Horák <dan at danny.cz>
Date:   Tue Jul 23 12:30:07 2013 +0200

    switch to systemd scriptlet macros

 mt-st.spec |   37 ++++++++-----------------------------
 1 files changed, 8 insertions(+), 29 deletions(-)
---
diff --git a/mt-st.spec b/mt-st.spec
index 927480c..a53618b 100644
--- a/mt-st.spec
+++ b/mt-st.spec
@@ -14,11 +14,10 @@ Patch3: mt-st-0.9b-manfix.patch
 Patch4: mt-st-1.1-mtio.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=948457
 Patch5: mt-st-1.1-options.patch
-Requires(post): systemd-units
-Requires(preun): systemd-units
-Requires(postun): systemd-units
-# For triggerun
-Requires(post): systemd-sysv
+BuildRequires: systemd
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
 
 %description
 The mt-st package contains the mt and st tape drive management
@@ -54,34 +53,13 @@ install -D -p -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/stinit.service
 
 
 %post
-if [ $1 -eq 1 ] ; then 
-    # Initial installation 
-    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
+%systemd_post stinit.service
 
 %preun
-if [ $1 -eq 0 ] ; then
-    # Package removal, not upgrade
-    /bin/systemctl --no-reload disable stinit.service > /dev/null 2>&1 || :
-    /bin/systemctl stop stinit.service > /dev/null 2>&1 || :
-fi
+%systemd_preun stinit.service
 
 %postun
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
-    # Package upgrade, not uninstall
-    /bin/systemctl try-restart stinit.service >/dev/null 2>&1 || :
-fi
-
-%triggerun -- mt-st < 1.1-7
-# Save the current service runlevel info
-# User must manually run systemd-sysv-convert --apply stinit
-# to migrate them to systemd targets
-/usr/bin/systemd-sysv-convert --save stinit >/dev/null 2>&1 ||:
-
-# Run these because the SysV package being removed won't do them
-/sbin/chkconfig --del stinit >/dev/null 2>&1 || :
-/bin/systemctl try-restart stinit.service >/dev/null 2>&1 || :
+%systemd_postun_with_restart stinit.service
 
 
 %files
@@ -95,6 +73,7 @@ fi
 %changelog
 * Tue Jul 23 2013 Dan Horák <dan[at]danny.cz> - 1.1-11
 - print all options in stinit's help (#948457)
+- switch to systemd scriptlet macros
 
 * Thu Feb 14 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.1-10
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild


More information about the scm-commits mailing list