s4: remove unused dbwrap code
[jra/samba/.git] / source4 / cluster / ctdb / packaging / RHEL / ctdb.spec
1 %define initdir %{_sysconfdir}/rc.d/init.d
2
3 Summary: Clustered TDB
4 Vendor: Samba Team
5 Packager: Samba Team <samba@samba.org>
6 Name: ctdb
7 Version: 1.0
8 Release: 1
9 Epoch: 0
10 License: GNU GPL version 2
11 Group: System Environment/Daemons
12 URL: bzr://www.samba.org/~tridge/ctdb/
13
14 Source: ctdb-%{version}.tar.bz2
15 Source999: ctdb-setup.tar.bz2
16
17 Prereq: /sbin/chkconfig /bin/mktemp /usr/bin/killall
18 Prereq: fileutils sed /etc/init.d
19
20 Requires: initscripts >= 5.54-1
21 Provides: ctdb = %{version}
22
23 Prefix: /usr
24 BuildRoot: %{_tmppath}/%{name}-%{version}-root
25
26 %description
27 ctdb is the clustered database used by samba
28
29
30 #######################################################################
31
32 %prep
33 %setup -q
34 # setup the init script and sysconfig file
35 %setup -T -D -a 999 -n ctdb-%{version} -q
36
37 %build
38
39 CC="gcc"
40
41 ## always run autogen.sh
42 ./autogen.sh
43
44 CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
45         --prefix=%{_prefix} \
46         --sysconfdir=%{_sysconfdir} \
47         --localstatedir="/var"
48
49 make showflags
50 make   
51
52 %install
53 # Clean up in case there is trash left from a previous build
54 rm -rf $RPM_BUILD_ROOT
55
56 # Create the target build directory hierarchy
57 mkdir -p $RPM_BUILD_ROOT%{_includedir}
58 mkdir -p $RPM_BUILD_ROOT{%{_libdir},%{_includedir}}
59 mkdir -p $RPM_BUILD_ROOT%{_prefix}/{bin,sbin}
60 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ctdb
61 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
62 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
63
64 make DESTDIR=$RPM_BUILD_ROOT install
65
66 install -m644 setup/ctdb.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ctdb
67 install -m755 setup/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb
68 install -m755 tools/events $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events
69 install -m755 tools/onnode.ssh $RPM_BUILD_ROOT%{_bindir}
70 install -m755 tools/onnode.rsh $RPM_BUILD_ROOT%{_bindir}
71 ln -sf %{_bindir}/onnode.ssh $RPM_BUILD_ROOT%{_bindir}/onnode
72
73 # unfortunately samba3 needs ctdb_private.h too
74 install -m644 include/ctdb_private.h $RPM_BUILD_ROOT%{_includedir}/ctdb_private.h
75
76
77 # Remove "*.old" files
78 find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
79
80 %clean
81 rm -rf $RPM_BUILD_ROOT
82
83 %post
84 /sbin/chkconfig --add ctdb
85
86 %preun
87 if [ $1 = 0 ] ; then
88     /sbin/chkconfig --del ctdb
89     /sbin/service ctdb stop >/dev/null 2>&1
90 fi
91 exit 0
92
93 %postun
94 if [ "$1" -ge "1" ]; then
95         %{initdir}/ctdb restart >/dev/null 2>&1
96 fi      
97
98
99 #######################################################################
100 ## Files section                                                     ##
101 #######################################################################
102
103 %files
104 %defattr(-,root,root)
105
106 %config(noreplace) %{_sysconfdir}/sysconfig/ctdb
107 %attr(755,root,root) %config %{initdir}/ctdb
108
109 %{_sysconfdir}/ctdb/events
110 %{_sbindir}/ctdbd
111 %{_bindir}/ctdb
112 %{_bindir}/onnode.ssh
113 %{_bindir}/onnode.rsh
114 %{_bindir}/onnode
115 %{_includedir}/ctdb.h
116 %{_includedir}/ctdb_private.h
117