On 10/22/2012 03:46 PM, Jakub Hrozek wrote:
On Mon, Oct 22, 2012 at 02:00:29PM +0200, Pavel Březina wrote:
On 10/19/2012 12:43 PM, Jakub Hrozek wrote:
On Fri, Oct 19, 2012 at 10:19:25AM +0200, Pavel Březina wrote:
On 10/18/2012 03:24 PM, Simo Sorce wrote:
On Thu, 2012-10-18 at 09:46 +0200, Pavel Březina wrote:
https://fedorahosted.org/sssd/ticket/1437

Fedora F15 has been EOLed and will not get updates, why bother with
F15 ?
Also F15 systemd was quite immature, and at the time guidelines
mentioned you shouldn't change from sysv to systemd after GA.
Did you mean to put F16 there ?

Simo.


OK. New patch is attached.


Hi,

  %if (0%{?enable_experimental} == 1)
@@ -57,6 +61,12 @@ Requires(post): initscripts chkconfig
  Requires(preun):  initscripts chkconfig
  Requires(postun): initscripts chkconfig

+%if (0%{?use_systemd} == 1)
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%endif

I think here ^^ should be an %else that would otherwise Require
initscripts. I don't think we need them in a pure systemd-enabled
package.

I'm no spec file expert, but everything is basically copy and paste
from our Fedora spec file so I assume it should be correct.

The Fedora spec file says:
Requires(post): systemd-units initscripts chkconfig

Right, I think the initscripts Requires is spurious,

I'm sending new patch that requires initscripts conditionally.

but we keep
chkconfig to migrate from sysv scripts (which Pavel just showed me is
forbidden by the Packaging Guidelines).

From 61f2936adefc33404030d8780f9fccc1e7e28ec2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrez...@redhat.com>
Date: Mon, 15 Oct 2012 16:20:24 +0200
Subject: [PATCH] use systemd by default on fedora16+

https://fedorahosted.org/sssd/ticket/1437
---
 contrib/sssd.spec.in | 68 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 64 insertions(+), 4 deletions(-)

diff --git a/contrib/sssd.spec.in b/contrib/sssd.spec.in
index 4f39647379c954cc6e07c8278907fee2c91d2bac..04750110db25b042824c25f509b8e0a40d58a866 100644
--- a/contrib/sssd.spec.in
+++ b/contrib/sssd.spec.in
@@ -22,6 +22,10 @@
     %global with_ccache --with-default-ccache-dir='/run/user/%U' --with-default-ccname-template="DIR:%d/krb5cc"
 %endif
 
+%if (0%{?fedora} >= 16)
+    %global use_systemd 1
+%endif
+
 %global enable_experimental 1
 
 %if (0%{?enable_experimental} == 1)
@@ -53,9 +57,18 @@ Requires: libipa_hbac = %{version}-%{release}
 Requires: libsss_idmap = %{version}-%{release}
 Requires: cyrus-sasl-gssapi
 Requires: keyutils-libs
-Requires(post): initscripts chkconfig
-Requires(preun):  initscripts chkconfig
-Requires(postun): initscripts chkconfig
+Requires(post): chkconfig
+Requires(preun): chkconfig
+Requires(postun): chkconfig
+%if (0%{?use_systemd} == 1)
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%else
+Requires(post): initscripts
+Requires(preun): initscripts
+Requires(postun): initscripts
+%endif
 
 %global servicename sssd
 %global sssdstatedir %{_localstatedir}/lib/sss
@@ -290,6 +303,13 @@ install -m644 src/examples/logrotate $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/s
 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rwtab.d
 install -m644 src/examples/rwtab $RPM_BUILD_ROOT%{_sysconfdir}/rwtab.d/sssd
 
+%if (0%{?use_systemd} == 1)
+# Replace sysv init script with systemd unit file
+rm -f $RPM_BUILD_ROOT/%{_initrddir}/%{name}
+mkdir -p $RPM_BUILD_ROOT/%{_unitdir}/
+cp src/sysv/systemd/sssd.service $RPM_BUILD_ROOT/%{_unitdir}/
+%endif
+
 # Remove .la files created by libtool
 find $RPM_BUILD_ROOT -name "*.la" -exec rm -f {} \;
 
@@ -336,8 +356,12 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(-,root,root,-)
 %doc COPYING
 %doc src/examples/sssd-example.conf
-%{_initrddir}/%{name}
 %{_sbindir}/sssd
+%if (0%{?use_systemd} == 1)
+%{_unitdir}/sssd.service
+%else
+%{_initrddir}/%{name}
+%endif
 
 %dir %{_libexecdir}/%{servicename}
 %{_libexecdir}/%{servicename}/krb5_child
@@ -506,6 +530,41 @@ A utility library to allow communication between Autofs and SSSD
 %doc src/sss_client/COPYING src/sss_client/COPYING.LESSER
 %{_libdir}/sssd/modules/libsss_autofs.so*
 
+%if (0%{?use_systemd} == 1)
+# systemd
+%post
+if [ $1 -ge 1 ] ; then
+    # Initial installation
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun
+if [ $1 = 0 ]; then
+     # Package removal, not upgrade
+    /bin/systemctl --no-reload disable sssd.service > /dev/null 2>&1 || :
+    /bin/systemctl stop sssd.service > /dev/null 2>&1 || :
+fi
+
+%triggerun -- sssd < %{version}-%{release}
+if /sbin/chkconfig --level 3 sssd ; then
+        /bin/systemctl --no-reload enable sssd.service >/dev/null 2>&1 || :
+fi
+
+if /sbin/chkconfig --level 5 sssd ; then
+        /bin/systemctl --no-reload enable sssd.service >/dev/null 2>&1 || :
+fi
+
+/sbin/chkconfig --del sssd >/dev/null 2>&1 || :
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # On upgrade, reload init system configuration if we changed unit files
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+    /bin/systemctl try-restart sssd.service >/dev/null 2>&1 || :
+fi
+%else
+# sysv
 %post
 /sbin/chkconfig --add %{servicename}
 
@@ -518,6 +577,7 @@ if [ $1 = 0 ]; then
     /sbin/service %{servicename} stop 2>&1 > /dev/null
     /sbin/chkconfig --del %{servicename}
 fi
+%endif
 
 %post client -p /sbin/ldconfig
 
-- 
1.7.11.7

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to