Logoj0ke.net Open Build Service > Projects > ha > csync2-git > csync2.spec
Sign Up | Log In

File csync2.spec of Package csync2-git (Revision 5025a7793e88f0b40fb211a42c745dba)

Currently displaying revision 5025a7793e88f0b40fb211a42c745dba, show latest

x
 
1
# csync2 - cluster synchronization tool, 2nd generation
2
# LINBIT Information Technologies GmbH <http://www.linbit.com>
3
# Copyright (C) 2004, 2005  Clifford Wolf <clifford@clifford.at>
4
#
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
9
#
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19
#
20
# spec file for package csync2 (Version 2.0)
21
#
22
23
# norootforbuild
24
# neededforbuild librsync openssl openssl-devel glibc-devel libgcc gcc gcc-c++ bison flex
25
%define sqliteversion 2.8.17
26
%define gitversion git20110703
27
BuildRequires: -post-build-checks
28
BuildRequires: sqlite-devel sqlite librsync openssl-devel glibc-devel libgcc gcc gcc-c++ bison flex gnutls gnutls-devel libtasn1-devel libtasn1 file
29
BuildRequires: autoconf automake libtool pkgconfig
30
%if 0%{?suse_version} >= 1100
31
BuildRequires:  libgnutls-devel
32
%endif
33
%if 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora_version} || 0%{?suse_version} < 1100
34
BuildRequires:  gnutls-devel
35
%endif
36
37
Requires:     librsync openssl file logrotate
38
Name:         csync2
39
License:      GPL
40
Group:        System/Monitoring
41
Requires:     sqlite openssl librsync
42
Autoreqprov:  on
43
Version:      1.99.01
44
Release:      1
45
Source0:      csync2-%{gitversion}.tar.bz2
46
Source1:      sqlite-%{sqliteversion}.tar.bz2
47
Source2:      create_csync2_ssl.sh
48
Source3:      paper.pdf     
49
Source4:      csync2.logrotate
50
Source5:      csync2.cron
51
Patch0:       csync2-SQL-TRUE.patch
52
URL:          http://oss.linbit.com/csync2
53
BuildRoot:    %{_tmppath}/%{name}-%{version}-build
54
Summary:      Cluster sync tool
55
56
%description
57
Csync2 is a cluster synchronization tool. It can be used to keep files on 
58
multiple hosts in a cluster in sync. Csync2 can handle complex setups with 
59
much more than just 2 hosts, handle file deletions and can detect conflicts.
60
It is expedient for HA-clusters, HPC-clusters, COWs and server farms. 
61
62
63
64
Authors:
65
--------
66
    Clifford Wolf <clifford.wolf@linbit.com>
67
68
%prep
69
%setup -n %{name}
70
%patch0
71
72
tar -C $RPM_BUILD_DIR -xjf %{S:1}
73
%{?suse_update_config:%{suse_update_config}}
74
autoreconf -fi
75
76
77
%build
78
export CFLAGS="$RPM_OPT_FLAGS -I/usr/kerberos/include"
79
if ! [ -f configure ]; then ./autogen.sh; fi
80
%configure && cat config.h
81
%__make all 
82
83
cd $RPM_BUILD_DIR/sqlite-%{sqliteversion}
84
./configure --enable-static --disable-shared
85
%__make all
86
87
%install
88
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT
89
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
90
mkdir -p $RPM_BUILD_ROOT%{_var}/lib/csync2
91
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d
92
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
93
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/cron.d
94
mkdir -p $RPM_BUILD_ROOT/var/backups/csync2
95
%__make DESTDIR=%{buildroot} install
96
%__install -m 755 %{S:2} $RPM_BUILD_ROOT%{_sbindir}/csync2_create_ssl.sh
97
%__install -m 644 %{S:3} paper.pdf
98
%__install -m 644 csync2.xinetd $RPM_BUILD_ROOT%{_sysconfdir}/xinetd.d/csync2
99
%__install -m 644 %{S:4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/csync2
100
%__install -m 644 %{S:5} $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/csync2
101
%__install -m 755 $RPM_BUILD_DIR/sqlite-%{sqliteversion}/sqlite $RPM_BUILD_ROOT%{_sbindir}/csync2-sqlite2
102
103
%clean
104
[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT
105
make clean
106
107
%post
108
if ! grep -q "^csync2" %{_sysconfdir}/services ; then
109
     echo "csync2          30865/tcp" >>%{_sysconfdir}/services
110
fi
111
if [ $1 == 2 ] ; then
112
for DB in `ls -1A /var/lib/csync2/*.db 2>/dev/null` ; do
113
    # find sqlite2 databases
114
    file ${DB} | grep -i "sqlite 2" >/dev/null
115
    if [ $? == 0 ] ; then
116
        # save sqlite2 databases
117
        mv ${DB} ${DB}.rpmsave
118
        # migrate sqlite2 databases to sqlite3
119
        if [ -x %{_sbindir}/csync2-sqlite2 ] && [ -x %{_bindir}/sqlite3 ] ; then
120
            %{_sbindir}/csync2-sqlite2 ${DB}.rpmsave .dump | %{_bindir}/sqlite3 ${DB}3
121
        fi
122
    elif [ ! -f ${DB}3 ] ; then
123
        mv ${DB} ${DB}3
124
    fi
125
done
126
fi
127
128
%files
129
%defattr(-,root,root)
130
%doc ChangeLog README NEWS INSTALL TODO AUTHORS paper.pdf
131
%attr(0755,root,root) %doc csync2_locheck.sh
132
%{_sbindir}/csync2
133
%{_sbindir}/csync2-compare
134
%{_sbindir}/csync2-sqlite2
135
%{_sbindir}/csync2_create_ssl.sh
136
%{_var}/lib/csync2
137
%{_mandir}/man1/csync2.1.gz
138
%config(noreplace) %{_sysconfdir}/xinetd.d/csync2
139
%config(noreplace) %{_sysconfdir}/csync2.cfg
140
%config %{_sysconfdir}/logrotate.d/csync2
141
%config %{_sysconfdir}/cron.d/csync2
142
%dir /var/backups
143
%dir /var/backups/csync2
144
145
%changelog
146