]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # TODO: | |
3 | # - trigger to update drbd-8.2 config | |
4 | # - warning: Installed (but unpackaged) file(s) found: | |
5 | # /etc/xen/scripts/block-drbd | |
6 | # /usr/lib/ocf/resource.d/linbit/drbd | |
7 | # | |
8 | # Conditional build: | |
9 | %bcond_without dist_kernel # allow non-distribution kernel | |
10 | %bcond_without kernel # don't build kernel modules | |
11 | %bcond_without userspace # don't build userspace module | |
12 | %bcond_with verbose # verbose build (V=1) | |
13 | %bcond_with grsec_kernel # build for kernel-grsecurity | |
14 | # | |
15 | %ifarch sparc | |
16 | %undefine with_smp | |
17 | %endif | |
18 | ||
19 | %if %{without kernel} | |
20 | %undefine with_dist_kernel | |
21 | %endif | |
22 | %if %{with kernel} && %{with dist_kernel} && %{with grsec_kernel} | |
23 | %define alt_kernel grsecurity | |
24 | %endif | |
25 | %if "%{_alt_kernel}" != "%{nil}" | |
26 | %undefine with_userspace | |
27 | %endif | |
28 | ||
29 | %define _rel 4 | |
30 | %define pname drbd | |
31 | Summary: drbd is a block device designed to build high availibility clusters | |
32 | Summary(pl.UTF-8): drbd jest urządzeniem blokowym dla klastrów o wysokiej niezawodności | |
33 | Name: %{pname}%{_alt_kernel} | |
34 | Version: 8.3.2 | |
35 | Release: %{_rel} | |
36 | License: GPL | |
37 | Group: Base/Kernel | |
38 | Source0: http://oss.linbit.com/drbd/8.3/%{pname}-%{version}.tar.gz | |
39 | # Source0-md5: 8aa8f7891d397ff25b7a3f77f56d353b | |
40 | Patch0: %{pname}-Makefile.patch | |
41 | Patch1: %{pname}-swab.patch | |
42 | Patch2: %{pname}-parallel-install.patch | |
43 | Patch3: %{pname}-bash-completion-install.patch | |
44 | URL: http://www.drbd.org/ | |
45 | %if %{with userspace} | |
46 | BuildRequires: bison | |
47 | BuildRequires: flex | |
48 | %endif | |
49 | %{?with_dist_kernel:BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.20.2} | |
50 | BuildRequires: rpmbuild(macros) >= 1.379 | |
51 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
52 | ||
53 | %description | |
54 | drbd is a block device which is designed to build high availability | |
55 | clusters. This is done by mirroring a whole block device via (a | |
56 | dedicated) network. You could see it as a network RAID1. | |
57 | ||
58 | %description -l pl.UTF-8 | |
59 | drbd jest urządzeniem blokowym zaprojektowanym dla klastrów o wysokiej | |
60 | niezawodności. drbd działa jako mirroring całego urządzenia blokowego | |
61 | przez (dedykowaną) sieć. Może być widoczny jako sieciowy RAID1. | |
62 | ||
63 | %description -l pt_BR.UTF-8 | |
64 | O DRBD é um dispositivo de bloco que é projetado para construir | |
65 | clusters de Alta Disponibilidade. Isto é feito espelhando um | |
66 | dispositivo de bloco inteiro via rede (dedicada ou não). Pode ser | |
67 | visto como um RAID 1 via rede. Este pacote contém utilitários para | |
68 | gerenciar dispositivos DRBD. | |
69 | ||
70 | %package -n drbdsetup | |
71 | Summary: Setup tool and scripts for DRBD | |
72 | Summary(pl.UTF-8): Narzędzie konfiguracyjne i skrypty dla DRBD | |
73 | Summary(pt_BR.UTF-8): Utilitários para gerenciar dispositivos DRBD | |
74 | Group: Applications/System | |
75 | Requires(post,preun): /sbin/chkconfig | |
76 | Requires(pre): /usr/bin/getgid | |
77 | Requires(pre): /usr/sbin/groupadd | |
78 | Requires(postun): /usr/sbin/groupdel | |
79 | Requires: rc-scripts | |
80 | Provides: group(haclient) | |
81 | Conflicts: drbdsetup24 | |
82 | Obsoletes: drbdsetup8 | |
83 | ||
84 | %description -n drbdsetup | |
85 | Setup tool and init scripts for DRBD. | |
86 | ||
87 | %description -n drbdsetup -l pl.UTF-8 | |
88 | Narzędzie konfiguracyjne i skrypty startowe dla DRBD. | |
89 | ||
90 | %package -n kernel%{_alt_kernel}-block-drbd | |
91 | Summary: Kernel module with drbd - a block device designed to build high availibility clusters | |
92 | Summary(pl.UTF-8): Moduł jądra do drbd - urządzenia blokowego dla klastrów o wysokiej niezawodności | |
93 | Release: %{_rel}@%{_kernel_ver_str} | |
94 | Group: Base/Kernel | |
95 | %{?with_dist_kernel:%requires_releq_kernel} | |
96 | Requires(post,postun): /sbin/depmod | |
97 | Requires: drbdsetup | |
98 | ||
99 | %description -n kernel%{_alt_kernel}-block-drbd | |
100 | drbd is a block device which is designed to build high availability | |
101 | clusters. This is done by mirroring a whole block device via (a | |
102 | dedicated) network. You could see it as a network RAID1. | |
103 | ||
104 | %description -n kernel%{_alt_kernel}-block-drbd -l pl.UTF-8 | |
105 | drbd jest urządzeniem blokowym zaprojektowanym dla klastrów o wysokiej | |
106 | niezawodności. drbd działa jako mirroring całego urządzenia blokowego | |
107 | przez (dedykowaną) sieć. Może być widoczny jako sieciowy RAID1. | |
108 | ||
109 | %package -n bash-completion-drbd | |
110 | Summary: bash-completion for drbd | |
111 | Summary(pl.UTF-8): Bashowe uzupełnianie poleceń dla drbd | |
112 | Group: Applications/Shells | |
113 | Requires: bash-completion | |
114 | ||
115 | %description -n bash-completion-drbd | |
116 | This package provides bash-completion for drbd. | |
117 | ||
118 | %description -n bash-completion-drbd -l pl.UTF-8 | |
119 | Ten pakiet dostarcza bashowe uzupełnianie poleceń dla drbd. | |
120 | ||
121 | %package -n drbd-udev | |
122 | Summary: udev rules for drbd kernel module | |
123 | Summary(pl.UTF-8): Reguły udev dla modułów jądra Linuksa dla drbd | |
124 | Group: Base/Kernel | |
125 | Requires: udev-core | |
126 | ||
127 | %description -n drbd-udev | |
128 | udev rules for drbd kernel module. | |
129 | ||
130 | %description -n drbd-udev -l pl.UTF-8 | |
131 | Reguły udev dla modułu jądra Linuksa dla drbd. | |
132 | ||
133 | %prep | |
134 | %setup -q -n %{pname}-%{version} | |
135 | %patch0 -p1 | |
136 | %patch1 -p1 | |
137 | %patch2 -p1 | |
138 | %patch3 -p1 | |
139 | ||
140 | %build | |
141 | %if %{with userspace} | |
142 | %{__make} tools \ | |
143 | KVER=dummy \ | |
144 | CC="%{__cc}" \ | |
145 | OPTCFLAGS="%{rpmcflags}" \ | |
146 | LDFLAGS="%{rpmldflags}" | |
147 | %endif | |
148 | ||
149 | %if %{with kernel} | |
150 | cd drbd | |
151 | sed -i -e 's#$(CONFIG_BLK_DEV_DRBD)#m#g' Makefile-2.6 | |
152 | ln -sf Makefile-2.6 Makefile | |
153 | # kernel module(s) | |
154 | %build_kernel_modules -m drbd | |
155 | %endif | |
156 | ||
157 | %install | |
158 | rm -rf $RPM_BUILD_ROOT | |
159 | install -d $RPM_BUILD_ROOT{/sbin,%{_mandir}/man{5,8},%{_sysconfdir}} \ | |
160 | $RPM_BUILD_ROOT{/etc/rc.d/init.d,/etc/ha.d/resource.d} | |
161 | ||
162 | %if %{with kernel} | |
163 | %install_kernel_modules -m drbd/drbd -d kernel/drivers/block | |
164 | %endif | |
165 | ||
166 | %if %{with userspace} | |
167 | %{__make} install -C scripts \ | |
168 | DRBD_ENABLE_UDEV=1 \ | |
169 | PREFIX=$RPM_BUILD_ROOT | |
170 | install scripts/drbd $RPM_BUILD_ROOT/etc/rc.d/init.d | |
171 | rm -rf $RPM_BUILD_ROOT/etc/init.d | |
172 | install user/{drbdadm,drbdmeta,drbdsetup} $RPM_BUILD_ROOT/sbin | |
173 | ||
174 | install documentation/*.5 $RPM_BUILD_ROOT%{_mandir}/man5 | |
175 | install documentation/*.8 $RPM_BUILD_ROOT%{_mandir}/man8 | |
176 | %endif | |
177 | ||
178 | %clean | |
179 | rm -rf $RPM_BUILD_ROOT | |
180 | ||
181 | %post -n kernel%{_alt_kernel}-block-drbd | |
182 | %depmod %{_kernel_ver} | |
183 | ||
184 | %postun -n kernel%{_alt_kernel}-block-drbd | |
185 | %depmod %{_kernel_ver} | |
186 | ||
187 | %pre -n drbdsetup | |
188 | %groupadd -g 60 haclient | |
189 | ||
190 | %post -n drbdsetup | |
191 | /sbin/chkconfig --add drbd | |
192 | %service drbd restart | |
193 | ||
194 | %preun -n drbdsetup | |
195 | if [ "$1" = "0" ]; then | |
196 | %service drbd stop | |
197 | /sbin/chkconfig --del drbd | |
198 | fi | |
199 | ||
200 | %postun -n drbdsetup | |
201 | if [ "$1" = "0" ]; then | |
202 | %groupremove haclient | |
203 | fi | |
204 | ||
205 | ||
206 | %if %{with userspace} | |
207 | %files -n drbdsetup | |
208 | %defattr(644,root,root,755) | |
209 | %attr(755,root,root) /sbin/drbdadm | |
210 | %attr(2754,root,haclient) /sbin/drbdsetup | |
211 | %attr(2754,root,haclient) /sbin/drbdmeta | |
212 | %attr(754,root,root) /etc/rc.d/init.d/drbd | |
213 | %attr(755,root,root) %{_sysconfdir}/ha.d/resource.d/drbddisk | |
214 | %attr(755,root,root) %{_sysconfdir}/ha.d/resource.d/drbdupper | |
215 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/drbd.conf | |
216 | %{_mandir}/man[58]/* | |
217 | %dir /usr/lib/drbd | |
218 | %attr(755,root,root) /usr/lib/drbd/* | |
219 | %attr(755,root,root) %{_sbindir}/drbd-overview | |
220 | ||
221 | %files -n bash-completion-drbd | |
222 | %defattr(644,root,root,755) | |
223 | /etc/bash_completion.d/drbdadm | |
224 | ||
225 | %files -n drbd-udev | |
226 | %defattr(644,root,root,755) | |
227 | %config(noreplace) %verify(not md5 mtime size) /etc/udev/rules.d/65-drbd.rules | |
228 | %endif | |
229 | ||
230 | %if %{with kernel} | |
231 | %files -n kernel%{_alt_kernel}-block-drbd | |
232 | %defattr(644,root,root,755) | |
233 | %doc ChangeLog README | |
234 | /lib/modules/%{_kernel_ver}/kernel/drivers/block/drbd.ko* | |
235 | %endif |