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
Instead of using -with-init-dir=%{_initrddir} in %configure and then
removing the init script, can we use --with-initscript=systemd and
optionally --with-systemdunitdir=. Can you check what do the Fedora
Packaging Guidelines say?
I'll check.
> +
> %global servicename sssd
> %global sssdstatedir %{_localstatedir}/lib/sss
> %global dbpath %{sssdstatedir}/db
> @@ -290,6 +300,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 +353,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 +527,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
I guess these ^^ are copied from the Fedora spec?
You are correct.
If so, then they are
probably correct (I haven't really tested this iteration of the
patch
yet), but can you also test that a package that is chkconfiged-on stays
enabled after an upgrade?