[watchdog] Migrate to systemd.

Jon Ciesla limb at fedoraproject.org
Wed Mar 14 16:59:16 UTC 2012


commit ae9505a50674d9b109ff3f472760ad0d7def570c
Author: Jon Ciesla <limburgher at gmail.com>
Date:   Wed Mar 14 11:59:04 2012 -0500

    Migrate to systemd.

 watchdog.spec |   65 +++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 47 insertions(+), 18 deletions(-)
---
diff --git a/watchdog.spec b/watchdog.spec
index 5d7876d..2617af4 100644
--- a/watchdog.spec
+++ b/watchdog.spec
@@ -1,7 +1,7 @@
 Summary:          Software and/or Hardware watchdog daemon
 Name:             watchdog
 Version:          5.9
-Release:          3%{?dist}
+Release:          4%{?dist}
 License:          GPL+
 Group:            System Environment/Daemons
 
@@ -21,11 +21,13 @@ Patch1:           watchdog-5.9-cleanups.patch
 
 BuildRoot:        %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
-Requires(post):   /sbin/chkconfig
-Requires(postun): /sbin/chkconfig
-Requires(post):   /sbin/service
-Requires(postun): /sbin/service
-
+#Requires(post):   /sbin/chkconfig
+#Requires(postun): /sbin/chkconfig
+#Requires(post):   /sbin/service
+#Requires(postun): /sbin/service
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
 
 %description
 The watchdog program can be used as a powerful software watchdog daemon 
@@ -67,8 +69,8 @@ rm -Rf ${RPM_BUILD_ROOT}
 install -d -m0755 ${RPM_BUILD_ROOT}%{_sysconfdir}
 make DESTDIR=${RPM_BUILD_ROOT} install
 install -Dp -m0644 %{name}.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/watchdog
-install -Dp -m0755 %{SOURCE1} ${RPM_BUILD_ROOT}%{_initrddir}/watchdog
-install -Dp -m0644 %{SOURCE4} ${RPM_BUILD_ROOT}/lib/systemd/system/watchdog.service
+#install -Dp -m0755 %%{SOURCE1} ${RPM_BUILD_ROOT}%%{_initrddir}/watchdog
+install -Dp -m0644 %{SOURCE4} ${RPM_BUILD_ROOT}%{_unitdir}/watchdog.service
 
 
 %clean
@@ -76,30 +78,54 @@ rm -Rf ${RPM_BUILD_ROOT}
 
 
 %post
-if [ $1 -eq 1 ]; then
-  /sbin/chkconfig --add %{name}
+#if [ $1 -eq 1 ]; then
+#  /sbin/chkconfig --add %{name}
+#fi
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
 fi
 
-
 %preun 
-if [ $1 -eq 0 ]; then
-  /sbin/service %{name} stop >/dev/null 2>&1
-  /sbin/chkconfig --del %{name}
+#if [ $1 -eq 0 ]; then
+#  /sbin/service %{name} stop >/dev/null 2>&1
+#  /sbin/chkconfig --del %{name}
+#fi
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable watchdog.service > /dev/null 2>&1 || :
+    /bin/systemctl stop watchdog.service > /dev/null 2>&1 || :
 fi
 
 
+
 %postun 
-if [ $1 -ge 1 ]; then
-  /sbin/service %{name} condrestart >/dev/null  2>&1
+#if [ $1 -ge 1 ]; then
+#  /sbin/service %{name} condrestart >/dev/null  2>&1
+#fi
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart watchdog.service >/dev/null 2>&1 || :
 fi
 
+%triggerun -- watchdog < 5.9-4
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply watchdog
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save watchdog >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del watchdog >/dev/null 2>&1 || :
+/bin/systemctl try-restart watchdog.service >/dev/null 2>&1 || :
+
 
 %files
 %defattr(-, root, root, -)
 %doc AUTHORS ChangeLog COPYING examples/ IAFA-PACKAGE NEWS README TODO README.watchdog.ipmi README.Fedora
 %config(noreplace) %{_sysconfdir}/watchdog.conf
 %config(noreplace) %{_sysconfdir}/sysconfig/watchdog
-%{_sysconfdir}/rc.d/init.d/watchdog
+#%%{_sysconfdir}/rc.d/init.d/watchdog
 %{_sbindir}/watchdog
 %{_sbindir}/wd_identify
 %{_sbindir}/wd_keepalive
@@ -107,10 +133,13 @@ fi
 %{_mandir}/man8/watchdog.8*
 %{_mandir}/man8/wd_identify.8*
 %{_mandir}/man8/wd_keepalive.8*
-/lib/systemd/system/watchdog.service
+%{_unitdir}/watchdog.service
 
 
 %changelog
+* Wed Mar 14 2012 Jon Ciesla <limburgher at gmail.com> - 5.9-4
+- Migrate to systemd, BZ 661220.
+
 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 5.9-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list