Blob Blame History Raw
# Conditionals
# Invoke "rpmbuild --without <feature>" or "rpmbuild --with <feature>"
# to disable or enable specific features
%bcond_with runautogen
%bcond_without systemd

%global gitver %{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}
%global gittarver %{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}

Name: corosync-qdevice
Summary: The Corosync Cluster Engine Qdevice
Version: 2.90.0
Release: 4%{?gitver}%{?dist}
License: BSD

# Runtime bits
Requires: corosync >= 2.4.0
Requires: corosynclib >= 2.4.0
Requires: nss-tools

%if %{with systemd}
BuildRequires: systemd
BuildRequires: systemd-devel
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig

# Build bits
BuildRequires: corosynclib-devel
BuildRequires: groff
BuildRequires: libqb-devel
BuildRequires: nss-devel
BuildRequires: sed

%if %{with runautogen}
BuildRequires: autoconf automake libtool

%setup -q -n %{name}-%{version}%{?gittarver}

%if %{with runautogen}

%{configure} \
%if %{with systemd}
	--enable-systemd \
	--enable-qdevices \
	--enable-qnetd \
	--with-initddir=%{_initrddir} \

make %{_smp_mflags}

make install DESTDIR=%{buildroot}

## tree fixup
# drop docs and html docs for now
rm -rf %{buildroot}%{_docdir}/*
mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
# /etc/sysconfig/corosync-qdevice
install -m 644 init/corosync-qdevice.sysconfig.example \
# /etc/sysconfig/corosync-qnetd
install -m 644 init/corosync-qnetd.sysconfig.example \

%if %{with systemd}
sed -i -e 's/^#User=/User=/' \
sed -i -e 's/^COROSYNC_QNETD_RUNAS=""$/COROSYNC_QNETD_RUNAS="coroqnetd"/' \

This package contains the Corosync Cluster Engine Qdevice, script for creating
NSS certificates and an init script.

%if %{with systemd} && 0%{?systemd_post:1}
%systemd_post corosync-qdevice.service
if [ $1 -eq 1 ]; then
	/sbin/chkconfig --add corosync-qdevice || :

%if %{with systemd} && 0%{?systemd_preun:1}
%systemd_preun corosync-qdevice.service
if [ $1 -eq 0 ]; then
	/sbin/service corosync-qdevice stop &>/dev/null || :
	/sbin/chkconfig --del corosync-qdevice || :

%if %{with systemd} && 0%{?systemd_postun:1}
%systemd_postun corosync-qdevice.service

%dir %{_sysconfdir}/corosync/qdevice
%dir %config(noreplace) %{_sysconfdir}/corosync/qdevice/net
%dir %{_localstatedir}/run/corosync-qdevice
%config(noreplace) %{_sysconfdir}/sysconfig/corosync-qdevice
%if %{with systemd}

%package -n corosync-qnetd
Summary: The Corosync Cluster Engine Qdevice Network Daemon
Requires: nss-tools
Requires(pre): shadow-utils

%if %{with systemd}

%description -n corosync-qnetd
This package contains the Corosync Cluster Engine Qdevice Network Daemon,
script for creating NSS certificates and an init script.

%pre -n corosync-qnetd
getent group coroqnetd >/dev/null || groupadd -r coroqnetd
getent passwd coroqnetd >/dev/null || \
    useradd -r -g coroqnetd -d / -s /sbin/nologin -c "User for corosync-qnetd" coroqnetd
exit 0

%post -n corosync-qnetd
%if %{with systemd} && 0%{?systemd_post:1}
%systemd_post corosync-qnetd.service
if [ $1 -eq 1 ]; then
	/sbin/chkconfig --add corosync-qnetd || :

%preun -n corosync-qnetd
%if %{with systemd} && 0%{?systemd_preun:1}
%systemd_preun corosync-qnetd.service
if [ $1 -eq 0 ]; then
	/sbin/service corosync-qnetd stop &>/dev/null || :
	/sbin/chkconfig --del corosync-qnetd || :

%postun -n corosync-qnetd
%if %{with systemd} && 0%{?systemd_postun:1}
%systemd_postun corosync-qnetd.service

%files -n corosync-qnetd
%dir %config(noreplace) %attr(770, coroqnetd, coroqnetd) %{_sysconfdir}/corosync/qnetd
%dir %attr(770, coroqnetd, coroqnetd) %{_localstatedir}/run/corosync-qnetd
%config(noreplace) %{_sysconfdir}/sysconfig/corosync-qnetd
%if %{with systemd}

* Thu Mar 22 2018 Jan Friesse <> - 2.90.0-4
- Rebuild for new Corosync

* Wed Feb 07 2018 Fedora Release Engineering <> - 2.90.0-3
- Rebuilt for

* Wed Jan 24 2018 Jan Friesse <> - 2.90.0-2
- Fix spec file according to advices given in review by
  Robert-André Mauchin <>

* Tue Jan 23 2018 Jan Friesse <> - 2.90.0-1
- First upstream packaged version of corosync for rawhide review.