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