#
# Conditional build:
-%bcond_with apidocs # build apidocs
-
+%bcond_with apidocs # build apidocs (man3 pages are provided anyway)
+%bcond_without dbus # DBus events
+%bcond_without rdma # RDMA support
+%bcond_without snmp # SNMP protocol support
+#
Summary: Corosync - OSI Certified implementation of a complete cluster engine
Summary(pl.UTF-8): Corosync - implementacja silnika klastrowego certyfikowana przez OSI
Name: corosync
-Version: 1.2.8
-Release: 1
+Version: 1.4.3
+Release: 2.2
License: BSD
Group: Base
-Source0: http://devresources.linux-foundation.org/dev/openais/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz
-# Source0-md5: 43e97ef0d964ccb4063f40a4478eb679
+Source0: ftp://ftp:downloads@corosync.org/downloads/%{name}-%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 9e9943a7d9eb90fabd52d12b215c699c
+Source1: %{name}.init
+Source2: %{name}-notifyd.init
+Source3: %{name}-notifyd.sysconfig
+Source4: %{name}.service
+Source5: %{name}-notifyd.service
+Source6: %{name}.target
+Patch0: %{name}-makefile.patch
URL: http://www.corosync.org/
BuildRequires: autoconf >= 2.61
BuildRequires: automake
+%{?with_dbus:BuildRequires: dbus-devel}
+%{?with_apidocs:BuildRequires: doxygen}
+%if %{with rdma}
+BuildRequires: libibverbs-devel
+BuildRequires: librdmacm-devel
+%endif
+%{?with_snmp:BuildRequires: net-snmp-devel}
BuildRequires: nss-devel
BuildRequires: pkgconfig
-%{?with_apidocs:BuildRequires: doxygen}
Requires: %{name}-libs = %{version}-%{release}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+# short_service_name_get() is defined in executable
+%define skip_post_check_so libcoroipcs\.so.*
+
%description
The Corosync Cluster Engine is an OSI Certified implementation of a
complete cluster engine.
Certified implementation of a complete cluster engine.
%description libs -l pl.UTF-8
-Ten pakiet zawiera biblioteki Corosync Cluster Engine - pełnego silnika
-klastrowego certyfikowanego przez OSI.
+Ten pakiet zawiera biblioteki Corosync Cluster Engine - pełnego
+silnika klastrowego certyfikowanego przez OSI.
%package devel
Summary: Header files for Corosync libraries
Summary(pl.UTF-8): Pliki nagłówkowe bibliotek Corosync
Group: Development/Libraries
Requires: %{name}-libs = %{version}-%{release}
+Conflicts: openais-devel < 1.0
%description devel
This package contains the include files used to develop using Corosync
%description static -l pl.UTF-8
Ten pakiet zawiera statyczne biblioteki Corosync.
+%package -n mibs-corosync
+Summary: Corosync SNMP MIB data
+Summary(pl.UTF-8): Dane SNMP MIB dla Corosync
+Group: Applications/System
+Requires: mibs-dirs
+
+%description -n mibs-corosync
+Corosync SNMP MIB data.
+
+%description -n mibs-corosync -l pl.UTF-8
+Dane SNMP MIB dla Corosync.
+
%prep
%setup -q
+%patch0 -p1
%build
%{__aclocal}
%{__autoconf}
%{__autoheader}
%{__automake}
+# options not yet supported: monitoring, watchdog, augeas
%configure \
+ %{?with_dbus:--enable-dbus} \
--enable-nss \
+ %{?with_rdma:--enable-rdma} \
+ %{?with_snmp:--enable-snmp} \
--with-initddir=/etc/rc.d/init.d \
--with-lcrso-dir=%{_libdir}/lcrso
-# --enable-rdma (BR: librdmacm, libibverbs)
%{__make}
%{?with_apidocs:%{__make} doxygen}
-
+
%install
rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,/etc/sysconfig,%{systemdunitdir}}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
-%{__rm} -r $RPM_BUILD_ROOT/usr/share/doc/corosync
+%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/corosync
sed -e 's/^/#/' $RPM_BUILD_ROOT%{_sysconfdir}/corosync/corosync.conf.example \
>$RPM_BUILD_ROOT%{_sysconfdir}/corosync/corosync.conf
-%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/corosync/corosync.conf.example
+%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/corosync/corosync.conf.example*
%{?with_apidocs:install doc/api/man/man3/* $RPM_BUILD_ROOT%{_mandir}/man3}
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}-notifyd
+install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}-notifyd
+install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
+install %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}-notifyd.service
+install %{SOURCE6} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.target
+
%clean
rm -rf $RPM_BUILD_ROOT
+%post
+/sbin/chkconfig --add %{name}
+/sbin/chkconfig --add %{name}-notifyd
+%service %{name} restart
+%service %{name}-notifyd restart
+%systemd_post %{name}.service
+%systemd_post %{name}-notifyd.service
+%systemd_post %{name}.target
+
+%preun
+if [ "$1" = "0" ]; then
+ %service -q %{name} stop
+ /sbin/chkconfig --del %{name}
+ %service -q %{name}-notifyd stop
+ /sbin/chkconfig --del %{name}-notifyd
+fi
+%systemd_preun %{name}.service
+%systemd_preun %{name}-notifyd.service
+%systemd_preun %{name}.target
+
+%postun
+%systemd_reload
+
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%files
%defattr(644,root,root,755)
-%doc AUTHORS CHANGELOG LICENSE README.devmap README.recovery SECURITY TODO
+%doc AUTHORS ChangeLog LICENSE README.devmap README.recovery SECURITY TODO conf/corosync.conf.example*
%attr(754,root,root) /etc/rc.d/init.d/corosync
+%attr(754,root,root) /etc/rc.d/init.d/corosync-notifyd
+%{systemdunitdir}/%{name}.service
+%{systemdunitdir}/%{name}-notifyd.service
+%{systemdunitdir}/%{name}.target
+%verify(not md5 mtime size) %config(noreplace) /etc/sysconfig/%{name}-notifyd
%dir %{_sysconfdir}/corosync
%verify(not md5 mtime size) %config(noreplace) %{_sysconfdir}/corosync/corosync.conf
+%attr(755,root,root) %{_bindir}/corosync-blackbox
%attr(755,root,root) %{_sbindir}/corosync
%attr(755,root,root) %{_sbindir}/corosync-cfgtool
%attr(755,root,root) %{_sbindir}/corosync-cpgtool
%attr(755,root,root) %{_sbindir}/corosync-fplay
%attr(755,root,root) %{_sbindir}/corosync-keygen
+%attr(755,root,root) %{_sbindir}/corosync-notifyd
%attr(755,root,root) %{_sbindir}/corosync-objctl
%attr(755,root,root) %{_sbindir}/corosync-pload
%attr(755,root,root) %{_sbindir}/corosync-quorumtool
%{_mandir}/man8/corosync-cpgtool.8*
%{_mandir}/man8/corosync-fplay.8*
%{_mandir}/man8/corosync-keygen.8*
+%{_mandir}/man8/corosync-notifyd.8*
%{_mandir}/man8/corosync-objctl.8*
%{_mandir}/man8/corosync-pload.8*
%{_mandir}/man8/corosync-quorumtool.8*
+%dir %attr(700,root,root) /var/lib/corosync
%files libs
%defattr(644,root,root,755)
%{_libdir}/libquorum.a
%{_libdir}/libtotem_pg.a
%{_libdir}/libvotequorum.a
+
+%if %{with snmp}
+%files -n mibs-corosync
+%defattr(644,root,root,755)
+%{_datadir}/snmp/mibs/COROSYNC-MIB.txt
+%endif