2013-07-10 11:19:55 +04:00
%define with_systemd %{?_with_systemd: 1} %{?!_with_systemd: 0}
2007-06-03 11:39:11 +04:00
%define initdir %{_sysconfdir}/init.d
2010-05-26 04:01:37 +04:00
Name : ctdb
2007-05-28 00:48:18 +04:00
Summary : Clustered TDB
Vendor : Samba Team
Packager : Samba Team <samba@samba.org>
2010-07-02 07:21:08 +04:00
Version : @VERSION@
2013-07-26 07:57:03 +04:00
Release : @RELEASE@
2007-05-28 00:48:18 +04:00
Epoch : 0
2007-07-10 09:29:31 +04:00
License : GNU GPL version 3
2007-05-28 00:48:18 +04:00
Group : System Environment/Daemons
2007-06-01 15:10:49 +04:00
URL : http://ctdb.samba.org/
2007-05-28 00:48:18 +04:00
2007-06-11 06:30:32 +04:00
Source : ctdb-%{version} .tar.gz
2007-05-28 00:48:18 +04:00
2012-05-09 11:20:27 +04:00
# Packages
2023-06-19 03:39:29 +03:00
Requires : coreutils, sed, gawk, iptables, iproute, procps, ethtool
2012-05-09 11:20:27 +04:00
# Commands - package name might vary
2022-01-04 07:31:55 +03:00
Requires : /usr/bin/killall, /bin/kill, /bin/ss
2007-05-28 00:48:18 +04:00
Provides : ctdb = %{version}
Prefix : /usr
BuildRoot : %{_tmppath} /%{name} -%{version} -root
2013-07-04 09:14:10 +04:00
# Allow build with system libraries
# To enable, run rpmbuild with,
# "--with system_talloc"
# "--with system_tdb"
# "--with system_tevent"
2014-05-26 07:21:44 +04:00
#%define with_included_talloc %{?_with_system_talloc: 0} %{?!_with_system_talloc: 1}
#%define with_included_tdb %{?_with_system_tdb: 0} %{?!_with_system_tdb: 1}
#%define with_included_tevent %{?_with_system_tevent: 0} %{?!_with_system_tevent: 1}
%define with_included_talloc 0
%define with_included_tevent 0
%define with_included_tdb 0
2012-05-09 10:03:00 +04:00
2013-07-04 09:14:10 +04:00
# Required minimum library versions when building with system libraries
2013-06-13 06:55:29 +04:00
%define libtalloc_version 2.0.8
2016-09-15 09:36:33 +03:00
%define libtdb_version 1.3.11
2014-06-26 08:16:13 +04:00
%define libtevent_version 0.9.16
2012-05-09 10:03:00 +04:00
%if ! %with_included_talloc
BuildRequires : libtalloc-devel >= %{libtalloc_version}
2013-07-08 10:14:59 +04:00
Requires : libtalloc >= %{libtalloc_version}
2012-05-09 10:03:00 +04:00
%endif
%if ! %with_included_tdb
BuildRequires : libtdb-devel >= %{libtdb_version}
2013-07-08 10:14:59 +04:00
Requires : libtdb >= %{libtdb_version}
2012-05-09 10:03:00 +04:00
%endif
%if ! %with_included_tevent
BuildRequires : libtevent-devel >= %{libtevent_version}
2013-07-08 10:14:59 +04:00
Requires : libtevent >= %{libtevent_version}
2012-05-09 10:03:00 +04:00
%endif
2013-05-28 08:19:32 +04:00
# To build the ctdb-pcp-pmda package, run rpmbuild with "--with pmda"
%define with_pcp_pmda %{?_with_pmda: 1} %{?!_with_pmda: 0}
%if %with_pcp_pmda
BuildRequires : pcp-libs-devel
%endif
2013-07-10 11:19:55 +04:00
%if %{with_systemd}
BuildRequires : systemd-units
%endif
2007-05-28 00:48:18 +04:00
%description
ctdb is the clustered database used by samba
#######################################################################
2010-05-26 04:01:37 +04:00
2007-05-28 00:48:18 +04:00
%prep
%setup -q
# setup the init script and sysconfig file
2007-06-01 17:25:33 +04:00
%setup -T -D -n ctdb-%{version} -q
2007-05-28 00:48:18 +04:00
%build
2009-01-19 16:46:30 +03:00
## check for ccache
if ccache -h >/dev/null 2>&1 ; then
CC=" c c a c h e g c c "
else
CC=" g c c "
fi
export CC
2007-05-28 00:48:18 +04:00
2018-12-18 03:03:51 +03:00
CFLAGS=" $RPM_OPT_FLAGS $ E X T R A - D _ G N U _ S O U R C E " \
2022-03-28 13:38:36 +03:00
./configure \
2015-06-25 07:55:23 +03:00
--builtin-libraries=replace,popt \
2014-05-26 07:21:44 +04:00
--bundled-libraries=!talloc,!tevent,!tdb \
--minimum-library-version=talloc:%libtalloc_version,tdb:%libtdb_version,tevent:%libtevent_version \
2013-05-28 08:19:32 +04:00
%if %with_pcp_pmda
--enable-pmda \
2012-05-09 10:03:00 +04:00
%endif
2007-05-28 00:48:18 +04:00
--prefix=%{_prefix} \
2015-09-08 10:58:25 +03:00
--includedir=%{_includedir} /ctdb \
2014-09-02 10:18:01 +04:00
--libdir=%{_libdir} \
2016-03-01 04:20:35 +03:00
--libexecdir=%{_libexecdir} \
2007-05-29 10:23:47 +04:00
--sysconfdir=%{_sysconfdir} \
2007-06-09 09:28:32 +04:00
--mandir=%{_mandir} \
2018-03-05 12:34:48 +03:00
--localstatedir=%{_localstatedir}
2007-05-28 00:48:18 +04:00
2022-03-28 13:38:36 +03:00
make -j
2007-05-28 00:48:18 +04:00
%install
# Clean up in case there is trash left from a previous build
rm -rf $RPM_BUILD_ROOT
2022-03-28 13:38:36 +03:00
DESTDIR=$RPM_BUILD_ROOT make -j install
2007-05-28 00:48:18 +04:00
2018-04-24 12:58:23 +03:00
install -m644 config/ctdb.conf $RPM_BUILD_ROOT %{_sysconfdir} /ctdb
2018-02-20 10:22:33 +03:00
install -m644 config/ctdb.tunables $RPM_BUILD_ROOT %{_sysconfdir} /ctdb
2018-04-24 09:33:20 +03:00
install -m644 config/script.options $RPM_BUILD_ROOT %{_sysconfdir} /ctdb
2013-07-10 11:19:55 +04:00
2016-08-02 23:51:57 +03:00
mkdir -p $RPM_BUILD_ROOT %{_sysconfdir} /sysconfig
2018-04-24 09:35:16 +03:00
install -m644 config/ctdb.sysconfig $RPM_BUILD_ROOT %{_sysconfdir} /sysconfig/ctdb
2016-08-02 23:51:57 +03:00
2013-07-10 11:19:55 +04:00
%if %{with_systemd}
mkdir -p $RPM_BUILD_ROOT %{_unitdir}
install -m 755 config/ctdb.service $RPM_BUILD_ROOT %{_unitdir}
%else
mkdir -p $RPM_BUILD_ROOT %{initdir}
2007-06-02 13:40:07 +04:00
install -m755 config/ctdb.init $RPM_BUILD_ROOT %{initdir} /ctdb
2013-07-10 11:19:55 +04:00
%endif
2007-05-29 16:53:28 +04:00
2014-05-26 07:21:44 +04:00
# This is a hack. All documents should be installed in /usr/share/doc.
2018-05-15 06:39:15 +03:00
cp config/events/README README.eventscripts
2015-06-19 09:35:12 +03:00
rm -f $RPM_BUILD_ROOT %{_sysconfdir} /ctdb/nfs-checks.d/README
cp config/nfs-checks.d/README README.nfs-checks.d
2018-05-16 05:18:46 +03:00
cp config/notification.README README.notification
2013-07-04 06:45:32 +04:00
2007-05-28 00:48:18 +04:00
# Remove "*.old" files
find $RPM_BUILD_ROOT -name " * . o l d " -exec rm -f {} \;
%clean
rm -rf $RPM_BUILD_ROOT
2018-07-07 08:58:06 +03:00
%post
# If mandatory 00.ctdb event script is not enabled then enable it and
# some other scripts. The assumption here is that this is a
# first-time install or an upgrade to a version that requires event
# scripts to be enabled via symlinks.
required_script=" 0 0 . c t d b "
required_path=" %{_sysconfdir} / c t d b / e v e n t s / l e g a c y / $ { r e q u i r e d _ s c r i p t } . s c r i p t "
if [ ! -L " $ r e q u i r e d _ p a t h " ] && [ ! -e " $ r e q u i r e d _ p a t h " ] ; then
default_scripts=" $ { r e q u i r e d _ s c r i p t }
01.reclock
05.system
10.interface
2024-04-08 04:15:24 +03:00
95.database
2018-07-07 08:58:06 +03:00
"
for t in $default_scripts ; do
tgt=" %{_datadir} / c t d b / e v e n t s / l e g a c y / $ { t } . s c r i p t "
name=" %{_sysconfdir} / c t d b / e v e n t s / l e g a c y / $ { t } . s c r i p t "
# Directory is created via install and files
ln -s " $ t g t " " $ n a m e "
done
fi
2007-05-28 00:48:18 +04:00
2018-07-07 08:58:06 +03:00
%preun
# Uninstall, not upgrade. Clean up by removing any remaining links.
if [ " $ 1 " = " 0 " ] ; then
for i in " %{_sysconfdir} / c t d b / e v e n t s / l e g a c y / " *.script ; do
if [ -L " $ i " ] ; then
rm -f " $ i "
fi
done
fi
2007-05-28 00:48:18 +04:00
%files
%defattr (-,root,root)
2018-04-24 12:58:23 +03:00
%config (noreplace) %{_sysconfdir} /ctdb/ctdb.conf
2018-02-20 10:22:33 +03:00
%config (noreplace) %{_sysconfdir} /ctdb/ctdb.tunables
2018-04-24 09:33:20 +03:00
%config (noreplace) %{_sysconfdir} /ctdb/script.options
2018-03-29 07:11:04 +03:00
%{_sysconfdir} /ctdb/notify.sh
2012-05-17 04:17:51 +04:00
%config (noreplace) %{_sysconfdir} /ctdb/debug-hung-script.sh
2010-04-22 08:02:11 +04:00
%config (noreplace) %{_sysconfdir} /ctdb/ctdb-crash-cleanup.sh
2013-07-16 06:53:16 +04:00
%config (noreplace) %{_sysconfdir} /ctdb/debug_locks.sh
2013-07-10 11:19:55 +04:00
2016-08-02 23:51:57 +03:00
%config (noreplace, missingok) %{_sysconfdir} /sysconfig/ctdb
2013-07-10 11:19:55 +04:00
%if %{with_systemd}
%{_unitdir} /ctdb.service
%else
2008-06-27 03:31:18 +04:00
%attr (755,root,root) %{initdir} /ctdb
2013-07-10 11:19:55 +04:00
%endif
2016-03-08 08:30:41 +03:00
%doc README COPYING
2018-05-16 05:18:46 +03:00
%doc README.eventscripts README.notification
2013-07-04 06:45:32 +04:00
%doc doc/recovery-process.txt
2016-04-26 05:31:43 +03:00
%doc doc/cluster_mutex_helper.txt
2013-07-04 06:45:32 +04:00
%doc doc/*.html
2013-10-24 07:26:12 +04:00
%doc doc/examples
2018-02-16 06:03:07 +03:00
%dir %{_sysconfdir} /ctdb
2013-07-04 08:29:09 +04:00
%{_sysconfdir} /ctdb/functions
2024-04-05 09:12:40 +03:00
%{_sysconfdir} /ctdb/ctdb-backup-persistent-tdbs.sh
2018-05-15 06:39:15 +03:00
%dir %{_sysconfdir} /ctdb/events
%{_sysconfdir} /ctdb/events/*
2018-02-16 06:03:07 +03:00
%dir %{_sysconfdir} /ctdb/nfs-checks.d
2015-07-13 14:00:29 +03:00
%config (noreplace) %{_sysconfdir} /ctdb/nfs-checks.d/00.portmapper.check
2015-06-19 09:35:12 +03:00
%config (noreplace) %{_sysconfdir} /ctdb/nfs-checks.d/10.status.check
%config (noreplace) %{_sysconfdir} /ctdb/nfs-checks.d/20.nfs.check
%config (noreplace) %{_sysconfdir} /ctdb/nfs-checks.d/30.nlockmgr.check
%config (noreplace) %{_sysconfdir} /ctdb/nfs-checks.d/40.mountd.check
%config (noreplace) %{_sysconfdir} /ctdb/nfs-checks.d/50.rquotad.check
2007-05-31 05:09:45 +04:00
%{_sysconfdir} /ctdb/statd-callout
2015-06-24 14:36:14 +03:00
%{_sysconfdir} /ctdb/nfs-linux-kernel-callout
2007-05-29 09:15:00 +04:00
%{_sbindir} /ctdbd
%{_bindir} /ctdb
2009-04-29 19:58:17 +04:00
%{_bindir} /ping_pong
2011-05-04 16:28:26 +04:00
%{_bindir} /ltdbtool
2007-09-05 08:20:34 +04:00
%{_bindir} /ctdb_diagnostics
2007-05-30 05:17:52 +04:00
%{_bindir} /onnode
2016-02-12 02:12:13 +03:00
%dir %{_libexecdir} /ctdb
2018-05-08 09:03:54 +03:00
%{_libexecdir} /ctdb/*
2019-03-06 06:36:01 +03:00
%dir %{_libdir} /ctdb
2021-02-12 11:13:11 +03:00
%{_libexecdir} /tdb_mutex_check
2015-06-25 07:55:23 +03:00
%{_libdir} /ctdb/lib*
2018-07-06 09:38:43 +03:00
%dir %{_datadir} /ctdb/events
%{_datadir} /ctdb/events/*
2007-06-09 09:28:32 +04:00
%{_mandir} /man1/ctdb.1.gz
2016-02-12 11:40:43 +03:00
%{_mandir} /man1/ctdb_diagnostics.1.gz
2007-06-10 04:45:52 +04:00
%{_mandir} /man1/ctdbd.1.gz
2007-06-12 07:44:01 +04:00
%{_mandir} /man1/onnode.1.gz
2011-05-04 16:28:26 +04:00
%{_mandir} /man1/ltdbtool.1.gz
2011-03-26 13:55:30 +03:00
%{_mandir} /man1/ping_pong.1.gz
2018-05-13 08:41:38 +03:00
%{_mandir} /man5/ctdb.conf.5.gz
2018-04-04 12:17:59 +03:00
%{_mandir} /man5/ctdb-script.options.5.gz
2018-04-24 07:11:23 +03:00
%{_mandir} /man5/ctdb.sysconfig.5.gz
2013-12-06 04:33:57 +04:00
%{_mandir} /man7/ctdb.7.gz
2014-09-12 08:22:00 +04:00
%{_mandir} /man7/ctdb-statistics.7.gz
2013-12-06 04:33:57 +04:00
%{_mandir} /man7/ctdb-tunables.7.gz
2018-03-05 12:38:51 +03:00
%attr (0700,root,root) %dir %{_localstatedir} /lib/ctdb
2018-05-14 08:41:35 +03:00
%attr (0700,root,root) %dir %{_localstatedir} /lib/ctdb/*
2018-03-05 12:38:51 +03:00
%attr (0700,root,root) %dir %{_localstatedir} /run/ctdb
2010-05-26 04:01:37 +04:00
2010-08-23 10:00:19 +04:00
%package devel
2012-05-11 04:32:26 +04:00
Summary : CTDB development libraries
Group : Development/Libraries
2010-08-23 10:00:19 +04:00
%description devel
development libraries for ctdb
2010-05-26 04:01:37 +04:00
%files devel
%defattr (-,root,root)
2009-12-05 01:18:12 +03:00
2012-05-03 06:12:53 +04:00
%package tests
Summary : CTDB test suite
Group : Development/Tools
Requires : ctdb = %{version}
2019-03-06 11:16:55 +03:00
Requires : nc, tcpdump
2012-05-03 06:12:53 +04:00
%description tests
test suite for ctdb
%files tests
%defattr (-,root,root)
2016-10-11 03:30:37 +03:00
%dir %{_datadir} /%{name} /tests
%{_datadir} /%{name} /tests/*
2016-08-04 06:36:28 +03:00
%dir %{_libexecdir} /%{name} /tests
%{_libexecdir} /%{name} /tests/*
2012-05-03 06:12:53 +04:00
%{_bindir} /ctdb_run_tests
%{_bindir} /ctdb_run_cluster_tests
2018-10-11 11:32:09 +03:00
%{_bindir} /ctdb_local_daemons
2012-05-03 06:12:53 +04:00
%doc tests/README
2013-05-28 08:19:32 +04:00
%if %with_pcp_pmda
%package pcp-pmda
Summary : CTDB PCP pmda support
Group : Development/Tools
Requires : ctdb = %{version}
Requires : pcp-libs
%description pcp-pmda
Performance Co-Pilot (PCP) support for CTDB
%files pcp-pmda
2018-03-05 12:34:48 +03:00
%dir %{_localstatedir} /lib/pcp/pmdas/ctdb
%{_localstatedir} /lib/pcp/pmdas/ctdb/*
2013-05-28 08:19:32 +04:00
%endif