Update spec file to use systemd on Fedora 16 and above

This commit is contained in:
Alexander Bokovoy
2011-10-21 16:44:36 +03:00
committed by Martin Kosek
parent 109571d384
commit 80b4220a05

View File

@@ -24,10 +24,17 @@ Source0: freeipa-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if ! %{ONLY_CLIENT}
%if 0%{?fedora} >= 16
BuildRequires: 389-ds-base-devel >= 1.2.10
%else
BuildRequires: 389-ds-base-devel >= 1.2.9
%endif
BuildRequires: svrcore-devel
BuildRequires: /usr/share/selinux/devel/Makefile
BuildRequires: policycoreutils >= %{POLICYCOREUTILSVER}
%if 0%{?fedora} >= 16
BuildRequires: systemd-units
%endif
%endif
BuildRequires: nspr-devel
BuildRequires: nss-devel
@@ -89,7 +96,11 @@ Requires(pre): 389-ds-base >= 1.2.10-0.4.a4
Requires: openldap-clients
Requires: nss
Requires: nss-tools
%if 0%{?fedora} >= 16
Requires: krb5-server >= 1.9.1-15
%else
Requires: krb5-server
%endif
Requires: krb5-server-ldap
Requires: krb5-pkinit-openssl
Requires: cyrus-sasl-gssapi%{?_isa}
@@ -102,6 +113,11 @@ Requires: python-ldap
Requires: python-krbV
Requires: acl
Requires: python-pyasn1 >= 0.0.9a
%if 0%{?fedora} >= 16
Requires: systemd-units >= 36-3
Requires(pre): systemd-units
Requires(post): systemd-units
%endif
%if 0%{?fedora} >= 15
Requires: selinux-policy >= 3.9.16-18
%else
@@ -109,6 +125,12 @@ Requires: selinux-policy >= 3.9.7-27
%endif
Requires(post): selinux-policy-base
Requires: slapi-nis >= 0.21
%if 0%{?fedora} >= 16
Requires: pki-ca >= 9.0.15
Requires: pki-silent >= 9.0.15
# Only tomcat6 greater than this version provides proper systemd support
Requires: tomcat6 >= 6.0.32-17
%else
%if 0%{?fedora} >= 15
Requires: pki-ca >= 9.0.15
Requires: pki-silent >= 9.0.15
@@ -117,13 +139,19 @@ Requires: pki-setup >= 9.0.15
Requires: pki-ca >= 9.0.5
Requires: pki-silent >= 9.0.5
%endif
%endif
Requires: dogtag-pki-common-theme
Requires: dogtag-pki-ca-theme
%if 0%{?rhel}
Requires: subscription-manager
%endif
%if 0%{?fedora} >= 16
Requires(preun): python systemd-units
Requires(postun): python systemd-units
%else
Requires(preun): python initscripts chkconfig
Requires(postun): python initscripts chkconfig
%endif
# We have a soft-requires on bind. It is an optional part of
# IPA but if it is configured we need a way to require versions
@@ -252,6 +280,11 @@ package.
%build
export CFLAGS="$CFLAGS %{optflags}"
export CPPFLAGS="$CPPFLAGS %{optflags}"
%if 0%{?fedora} >= 16
export SUPPORTED_PLATFORM=fedora16
# Force re-generate of platform support
rm -f ipapython/services.py
%endif
make version-update
cd ipa-client; ../autogen.sh --prefix=%{_usr} --sysconfdir=%{_sysconfdir} --localstatedir=%{_localstatedir} --libdir=%{_libdir} --mandir=%{_mandir}; cd ..
%if ! %{ONLY_CLIENT}
@@ -270,6 +303,11 @@ make IPA_VERSION_IS_GIT_SNAPSHOT=no %{?_smp_mflags} client
%install
rm -rf %{buildroot}
%if 0%{?fedora} >= 16
export SUPPORTED_PLATFORM=fedora16
# Force re-generate of platform support
rm -f ipapython/services.py
%endif
%if ! %{ONLY_CLIENT}
make install DESTDIR=%{buildroot}
cd selinux
@@ -315,7 +353,13 @@ mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d/
/bin/touch %{buildroot}%{_sysconfdir}/httpd/conf.d/ipa-pki-proxy.conf
/bin/touch %{buildroot}%{_sysconfdir}/httpd/conf.d/ipa-rewrite.conf
mkdir -p %{buildroot}%{_initrddir}
install -m755 ipa.init %{buildroot}%{_initrddir}/ipa
%if 0%{?fedora} >= 16
# Default to systemd initscripts for F16 and above
mkdir -p %{buildroot}%{_unitdir}
install -m 644 init/systemd/ipa.service %{buildroot}%{_unitdir}/ipa.service
%else
install -m755 init/SystemV/ipa.init %{buildroot}%{_initrddir}/ipa
%endif
%endif
mkdir -p %{buildroot}%{_sysconfdir}/ipa/
@@ -334,9 +378,15 @@ rm -rf %{buildroot}
%if ! %{ONLY_CLIENT}
%post server
%if 0%{?fedora} >= 16
# Use systemd scheme
/bin/systemctl --system daemon-reload 2>&1 || :
%else
# Use SystemV scheme only before F16
if [ $1 = 1 ]; then
/sbin/chkconfig --add ipa
fi
%endif
if [ $1 -gt 1 ] ; then
/usr/sbin/ipa-upgradeconfig || :
/usr/sbin/ipa-ldap-updater --upgrade >/dev/null 2>&1 || :
@@ -344,13 +394,27 @@ fi
%preun server
if [ $1 = 0 ]; then
%if 0%{?fedora} >= 16
# Use systemd scheme
/bin/systemctl --quiet stop ipa.service || :
/bin/systemctl --quiet disable ipa.service || :
%else
# Use SystemV scheme only before F16
/sbin/chkconfig --del ipa
/sbin/service ipa stop >/dev/null 2>&1 || :
%endif
fi
%postun server
if [ "$1" -ge "1" ]; then
%if 0%{?fedora} >= 16
# Use systemd scheme
/bin/systemctl --quiet is-active ipa.service >/dev/null && \
/bin/systemctl try-restart ipa.service >/dev/null 2>&1 || :
%else
# Use SystemV scheme only before F16
/sbin/service ipa condrestart >/dev/null 2>&1 || :
%endif
fi
%pre server-selinux
@@ -419,7 +483,13 @@ fi
%{_sbindir}/ipa-upgradeconfig
%{_sbindir}/ipa-compliance
%{_sysconfdir}/cron.d/ipa-compliance
%if 0%{?fedora} >= 16
# Use systemd scheme
%attr(644,root,root) %{_unitdir}/ipa.service
%else
# Use SystemV scheme only before F16
%attr(755,root,root) %{_initrddir}/ipa
%endif
%dir %{python_sitelib}/ipaserver
%{python_sitelib}/ipaserver/*
%dir %{_usr}/share/ipa
@@ -549,6 +619,9 @@ fi
%ghost %attr(0644,root,apache) %config(noreplace) %{_sysconfdir}/ipa/default.conf
%changelog
* Fri Oct 21 2011 Alexander Bokovoy <abokovoy@redhat.com> - 2.99.0-8
- Default to systemd for Fedora 16 and onwards
* Fri Oct 14 2011 Rob Crittenden <rcritten@redhat.com> - 2.99.0-7
- Set min nvr of 389-ds-base to 1.2.10-0.4.a4 for limits fixes (740942, 742324)