merge from tridge
[metze/ctdb/wip.git] / packaging / RPM / ctdb.spec
1 %define initdir %{_sysconfdir}/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: 3
9 Epoch: 0
10 License: GNU GPL version 2
11 Group: System Environment/Daemons
12 URL: http://ctdb.samba.org/
13
14 Source: ctdb-%{version}.tar.bz2
15
16 Prereq: /sbin/chkconfig /bin/mktemp /usr/bin/killall
17 Prereq: fileutils sed /etc/init.d
18
19 Provides: ctdb = %{version}
20
21 Prefix: /usr
22 BuildRoot: %{_tmppath}/%{name}-%{version}-root
23
24 %description
25 ctdb is the clustered database used by samba
26
27
28 #######################################################################
29
30 %prep
31 %setup -q
32 # setup the init script and sysconfig file
33 %setup -T -D -n ctdb-%{version} -q
34
35 %build
36
37 CC="gcc"
38
39 ## always run autogen.sh
40 ./autogen.sh
41
42 CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
43         --prefix=%{_prefix} \
44         --sysconfdir=%{_sysconfdir} \
45         --localstatedir="/var"
46
47 make showflags
48 make   
49
50 %install
51 # Clean up in case there is trash left from a previous build
52 rm -rf $RPM_BUILD_ROOT
53
54 # Create the target build directory hierarchy
55 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
56 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d
57
58 make DESTDIR=$RPM_BUILD_ROOT install
59
60 install -m644 config/ctdb.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ctdb
61 install -m755 config/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb
62
63 # Remove "*.old" files
64 find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
65
66 %clean
67 rm -rf $RPM_BUILD_ROOT
68
69 %post
70 [ -x /sbin/chkconfig ] && /sbin/chkconfig --add ctdb
71
72 %preun
73 if [ $1 = 0 ] ; then
74     [ -x /sbin/chkconfig ] && /sbin/chkconfig --del ctdb
75 fi
76 exit 0
77
78 %postun
79 if [ "$1" -ge "1" ]; then
80         %{initdir}/ctdb restart >/dev/null 2>&1
81 fi      
82
83
84 #######################################################################
85 ## Files section                                                     ##
86 #######################################################################
87
88 %files
89 %defattr(-,root,root)
90
91 %config(noreplace) %{_sysconfdir}/sysconfig/ctdb
92 %attr(755,root,root) %config %{initdir}/ctdb
93
94 %{_sysconfdir}/ctdb/events
95 %{_sysconfdir}/ctdb/functions
96 %{_sysconfdir}/ctdb/events.d/10.interface
97 %{_sysconfdir}/ctdb/events.d/40.vsftpd
98 %{_sysconfdir}/ctdb/events.d/50.samba
99 %{_sysconfdir}/ctdb/events.d/59.nfslock
100 %{_sysconfdir}/ctdb/events.d/60.nfs
101 %{_sysconfdir}/ctdb/statd-callout
102 %{_sbindir}/ctdbd
103 %{_bindir}/ctdb
104 %{_bindir}/onnode.ssh
105 %{_bindir}/onnode.rsh
106 %{_bindir}/onnode
107 %{_includedir}/ctdb.h
108 %{_includedir}/ctdb_private.h