csync2/csync2.spec

158 lines
5.3 KiB
RPMSpec
Raw Normal View History

#
# spec file for package csync2
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Summary: Cluster synchronization tool
License: GPL-2.0+
Group: Productivity/Clustering/HA
Name: csync2
Version: 2.0+git.1368794815.cf835a7
Release: 0
Url: http://oss.linbit.com/csync2/
#Source0: http://oss.linbit.com/csync2/%{name}-%{version}.tar.gz
Source0: %{name}-%{version}.tar.bz2
Source1: csync2-README.quickstart
Source2: csync2-rm-ssl-cert
Source3: csync2.socket
Source4: csync2@.service
# PATCH-FIX-UPSTREAM -- csync2-fix-xinetd.patch tserong@suse.com -- disables csync2 in xinetd by default, fixes port.
Patch0: csync2-fix-xinetd.patch
# PATCH-FIX-UPSTREAM -- add-ac_prog_cpp.patch tserong@suse.com -- fix ugly ./configure warnings about missing headers
Patch10: add-ac_prog_cpp.patch
# PATCH-FIX-UPSTREAM -- fix-csync2_ssl_cert-filename.patch tserong@suse.com -- correct csync2 ssl cert filename
Patch11: fix-csync2_ssl_cert-filename.patch
# PATCH-FIX-UPSTREAM -- fix-sonames.patch tserong@suse.com -- use properly versioned sonames in dlopen()
Patch12: fix-sonames.patch
# PATCH-FIX-UPSTREAM -- add-COPYING.patch tserong@suse.com -- ensure COPYING is present in docfiles and thus %doc
Patch13: add-COPYING.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bison
BuildRequires: flex
BuildRequires: libgnutls-devel
BuildRequires: librsync-devel
# openssl required at build time due to rpmlint checks which run postinstall script which uses openssl
BuildRequires: openssl
BuildRequires: pkgconfig
BuildRequires: sqlite3-devel
Requires: openssl
Requires: sqlite3
%{?systemd_requires}
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%endif
# texlive is for pdflatex to build PDF version of the manual
BuildRequires: texlive-latex
%if 0%{?suse_version} > 1220
BuildRequires: texlive-nopageno
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Csync2 is a cluster synchronization tool. It can be used to keep files on
multiple hosts in a cluster in sync. Csync2 can handle complex setups with
much more than just 2 hosts, handle file deletions and can detect conflicts.
It is expedient for HA-clusters, HPC-clusters, COWs and server farms.
%prep
%setup -q
%{?suse_update_config:%{suse_update_config}}
%patch0 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%build
export CFLAGS="%{optflags}"
if ! [ -f configure ]; then ./autogen.sh; fi
%configure --enable-sqlite3 \
--sysconfdir=%{_sysconfdir}/csync2 --docdir=%{_docdir}/%{name}
make %{?_smp_mflags}
%install
%make_install
mkdir -p %{buildroot}%{_localstatedir}/lib/csync2
install -p -D -m 644 csync2.xinetd %{buildroot}%{_sysconfdir}/xinetd.d/csync2
install -p -m 644 %{SOURCE1} %{buildroot}%{_docdir}/%{name}/README.quickstart
install -p -m 755 %{SOURCE2} %{buildroot}%{_sbindir}/csync2-rm-ssl-cert
mkdir -p %{buildroot}%{_unitdir}
install -p -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/
install -p -m 644 %{SOURCE4} %{buildroot}%{_unitdir}/
# We need these empty files to be able to %%ghost them
touch %{buildroot}%{_sysconfdir}/csync2/csync2_ssl_key.pem
touch %{buildroot}%{_sysconfdir}/csync2/csync2_ssl_cert.pem
%pre
%service_add_pre csync2.socket
%post
%service_add_post csync2.socket
umask 077
if [ ! -f %{_sysconfdir}/csync2/csync2_ssl_key.pem ]; then
/usr/bin/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > %{_sysconfdir}/csync2/csync2_ssl_key.pem 2>/dev/null
fi
FQDN=`hostname`
if [ "x${FQDN}" = "x" ]; then
FQDN=localhost.localdomain
fi
if [ ! -f %{_sysconfdir}/csync2/csync2_ssl_cert.pem ]; then
cat << EOF | /usr/bin/openssl req -new -key %{_sysconfdir}/csync2/csync2_ssl_key.pem -x509 -days 3000 -out %{_sysconfdir}/csync2/csync2_ssl_cert.pem 2>/dev/null
--
SomeState
SomeCity
SomeOrganization
SomeOrganization
SomeName
name@example.com
EOF
fi
%preun
%service_del_preun csync2.socket
# Cleanup all databases upon last removal
if [ $1 -eq 0 ]; then
rm -f %{_localstatedir}/lib/csync2/*
fi
%postun
%service_del_postun csync2.socket
%files
%defattr(-,root,root)
%{_sbindir}/csync2
%{_sbindir}/csync2-compare
%{_unitdir}/csync2.socket
%{_unitdir}/csync2@.service
%dir %{_localstatedir}/lib/csync2/
# Using docdir here ensures correct doc file tagging
%{_docdir}/%{name}
%dir %{_sysconfdir}/csync2/
%config(noreplace) %{_sysconfdir}/csync2/csync2.cfg
%config(noreplace) %{_sysconfdir}/xinetd.d/csync2
%ghost %config %{_sysconfdir}/csync2/csync2_ssl_key.pem
%ghost %config %{_sysconfdir}/csync2/csync2_ssl_cert.pem
%{_sbindir}/csync2-rm-ssl-cert
%{_mandir}/man1/csync2.1*
%changelog