[ctdb/f17] Add systemd fixes (#829235)

sbose sbose at fedoraproject.org
Wed Jun 6 10:22:40 UTC 2012


commit 34ee1994b1015e287245fbecaf3e5e33f6eb401f
Author: Sumit Bose <sbose at redhat.com>
Date:   Wed Jun 6 12:21:01 2012 +0200

    Add systemd fixes (#829235)

 0002-Add-systemd-support.patch |    2 +-
 ctdb.spec                      |   34 ++++++++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/0002-Add-systemd-support.patch b/0002-Add-systemd-support.patch
index 4ab2c4c..7de8447 100644
--- a/0002-Add-systemd-support.patch
+++ b/0002-Add-systemd-support.patch
@@ -38,7 +38,7 @@ index 0000000..76b47bd
 +ExecStop=/usr/bin/ctdb shutdown
 +ExecStopPost=-/etc/ctdb/systemd/ctdb_drop_all_public_ips
 +KillMode=control-group
-+Restart=on-failure
++Restart=no
 +
 +[Install]
 +WantedBy=multi-user.target
diff --git a/ctdb.spec b/ctdb.spec
index b003ab9..bcaa9a2 100644
--- a/ctdb.spec
+++ b/ctdb.spec
@@ -4,7 +4,7 @@
 Summary: A Clustered Database based on Samba's Trivial Database (TDB)
 Name: ctdb
 Version: 1.2.39
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv3+
 Group: System Environment/Daemons
 URL: http://ctdb.samba.org/
@@ -34,9 +34,15 @@ Patch7: 0002-Add-systemd-support.patch
 Requires: chkconfig coreutils psmisc
 Requires: fileutils sed
 Requires: tdb-tools
+%if %{with_systemd}
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%else
 Requires(preun): chkconfig initscripts
 Requires(post): chkconfig
 Requires(postun): initscripts
+%endif
 
 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
 BuildRequires: autoconf net-tools popt-devel
@@ -126,6 +132,27 @@ cp -r COPYING web %{buildroot}%{_docdir}/ctdb-%{version}
 %clean
 rm -rf %{buildroot}
 
+%if %{with_systemd}
+%post
+if [ $1 -eq 1 ] ; then
+    # Initial installation
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable ctdb.service > /dev/null 2>&1 || :
+    /bin/systemctl stop ctdb.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart ctdb.service >/dev/null 2>&1 || :
+fi
+%else
 %post
 /sbin/chkconfig --add ctdb
 
@@ -139,7 +166,7 @@ fi
 if [ "$1" -ge "1" ]; then
  /sbin/service ctdb condrestart >/dev/null 2>&1 || true
 fi
-
+%endif
 
 # Files section
 
@@ -188,6 +215,9 @@ fi
 %{_libdir}/pkgconfig/ctdb.pc
 
 %changelog
+* Wed Jun 06 2012 Sumit Bose <sbose at redhat.com> - 1.2.39-2
+ - Add systemd fixes (#829235).
+
 * Wed Feb 01 2012 Sumit Bose <sbose at redhat.com> - 1.2.39-1
  - Update to ctdb version 1.2.39
  - Added support for systemd


More information about the scm-commits mailing list