[foghorn] Add scriptlets to handle migration from SysV to systemd.

rohara rohara at fedoraproject.org
Fri Jan 27 19:20:26 UTC 2012


commit e3680bb0cb7f4516bbf7a5cd03d81a9682ab5adc
Author: Ryan O'Hara <rohara at redhat.com>
Date:   Fri Jan 27 13:18:49 2012 -0600

    Add scriptlets to handle migration from SysV to systemd.
    
    Signed-off-by: Ryan O'Hara <rohara at redhat.com>

 foghorn.spec |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/foghorn.spec b/foghorn.spec
index 1169785..a6869f8 100644
--- a/foghorn.spec
+++ b/foghorn.spec
@@ -5,7 +5,7 @@
 
 Name: foghorn
 Version: 0.1.5
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: D-Bus to SNMP service.
 Group: System Environment/Base
 License: GPLv2+
@@ -22,8 +22,9 @@ BuildRequires: systemd-units
 
 Requires: cluster-snmp
 Requires: initscripts
-Requires(post): chkconfig
-Requires(preun): chkconfig
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 
 %description
 Daemon that listens for D-Bus signals and translates to SNMP traps.
@@ -43,13 +44,27 @@ make install DESTDIR=$RPM_BUILD_ROOT
 rm -rf $RPM_BUILD_ROOT
 
 %post
-/sbin/chkconfig --add foghorn
+if [ $1 -eq 1 ] ; then 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun
-if [ "$1" == 0 ] then;
-   /sbin/chkconfig --del foghorn
+if [ $1 -eq 0 ] ; then
+    /bin/systemctl --no-reload disable foghorn.service > /dev/null 2>&1 || :
+    /bin/systemctl stop foghorn.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    /bin/systemctl try-restart foghorn.service >/dev/null 2>&1 || :
 fi
 
+%triggerun -- foghorn < 0.1.5-2
+/usr/bin/systemd-sysv-convert --save foghorn >/dev/null 2>&1 ||:
+/sbin/chkconfig --del foghorn >/dev/null 2>&1 || :
+/bin/systemctl try-restart foghorn.service >/dev/null 2>&1 || :
+
 %files
 %defattr(-,root,root,-)
 %doc README AUTHORS NEWS COPYING
@@ -62,6 +77,10 @@ fi
 %{_sbindir}/foghorn
 
 %changelog
+* Fri Jan 20 2012 Ryan O'Hara <rohara at redhat.com> - 0.1.5-2
+- Add scriptlets to handle migration from SysV to systemd.
+- Resolves: rhbz#767593
+
 * Fri Jan 20 2012 Ryan O'Hara <rohara at redhat.com> - 0.1.5-1
 - Rebase to upstream version 0.1.5.
 - Fix problem with missing init script.


More information about the scm-commits mailing list