]> git.pld-linux.org Git - packages/lvm2.git/blob - lvm2.spec
lvm2-clvmd_cmd_timeout.patch patch added
[packages/lvm2.git] / lvm2.spec
1 # TODO
2 # - vgscan --ignorelocking failure creates /var/lock/lvm (even if /var is not yet mounted)
3 # - --with-replicators (=internal/shared/none, default is none)?
4 # - OCF agents?
5 #
6 # Conditional build:
7 %bcond_without  initrd          # don't build initrd version
8 %bcond_without  uClibc          # link initrd version with uClibc
9 %bcond_with     dietlibc        # link initrd version with dietlibc
10 %bcond_with     glibc           # link initrd version with static GLIBC
11 %bcond_without  cluster         # disable all cluster support (clvmd&cmirrord)
12 %bcond_with     lvmetad         # enable lvmetad
13 %bcond_without  selinux         # disable SELinux
14
15 %ifarch sparc64 sparc
16 %define         with_glibc 1
17 %endif
18
19 # if one of the *libc is enabled disable default dietlibc
20 %if %{with dietlibc} && %{with uClibc}
21 %undefine       with_dietlibc
22 %endif
23
24 # with glibc disables default dietlibc
25 %if %{with glibc} && %{with dietlibc}
26 %undefine       with_dietlibc
27 %endif
28
29 # fallback is glibc if neither alternatives are enabled
30 %if %{without dietlibc} && %{without uClibc}
31 %define         with_glibc      1
32 %endif
33
34 Summary:        The new version of Logical Volume Manager for Linux
35 Summary(pl.UTF-8):      Nowa wersja Logical Volume Managera dla Linuksa
36 Name:           lvm2
37 Version:        2.02.98
38 Release:        2
39 License:        GPL v2
40 Group:          Applications/System
41 Source0:        ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz
42 # Source0-md5:  1ce5b7f9981e1d02dfd1d3857c8d9fbe
43 Source1:        %{name}-tmpfiles.conf
44 Source2:        clvmd.service
45 Source3:        clvmd.sysconfig
46 Patch0:         %{name}-selinux.patch
47 Patch1:         %{name}-diet.patch
48 Patch2:         device-mapper-dmsetup-export.patch
49 Patch3:         %{name}-pld_init.patch
50 Patch4:         dl-dlsym.patch
51 Patch5:         %{name}-wrapper.patch
52 Patch6:         %{name}-lvm_path.patch
53 Patch7:         %{name}-sd_notify.patch
54 Patch8:         %{name}-clvmd_cmd_timeout.patch
55 URL:            http://sources.redhat.com/lvm2/
56 BuildRequires:  autoconf >= 2.61
57 BuildRequires:  automake
58 %{?with_selinux:BuildRequires:  libselinux-devel >= 1.10}
59 %{?with_selinux:BuildRequires:  libsepol-devel}
60 BuildRequires:  ncurses-devel
61 BuildRequires:  pkgconfig
62 BuildRequires:  readline-devel
63 BuildRequires:  rpmbuild(macros) >= 1.647
64 BuildRequires:  udev-devel >= 143
65 %if %{with initrd}
66 %if %{with dietlibc}
67 BuildRequires:  dietlibc-static >= 2:0.32-7
68 BuildConflicts: device-mapper-dietlibc
69 %endif
70 %if %{with glibc}
71 %{?with_selinux:BuildRequires:  libselinux-static}
72 %{?with_selinux:BuildRequires:  libsepol-static}
73 %endif
74 %{?with_glibc:BuildRequires:    glibc-static}
75 %{?with_uClibc:BuildRequires:   uClibc-static >= 2:0.9.29}
76 %endif
77 %if %{with cluster}
78 BuildRequires:  corosync-devel
79 BuildRequires:  dlm-devel >= 3.99.5
80 BuildRequires:  systemd-devel
81 %endif
82 Requires(post,preun,postun):    systemd-units >= 38
83 Requires(post,postun):  /sbin/chkconfig
84 Requires:       device-mapper >= %{version}-%{release}
85 %{?with_selinux:Requires:       libselinux >= 1.10}
86 Requires:       systemd-units >= 38
87 # doesn't work with 2.4 kernels
88 Requires:       uname(release) >= 2.6
89 Obsoletes:      lvm
90 Obsoletes:      lvm2-systemd
91 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
92
93 %define         _sbindir        /sbin
94 %define         _usrsbindir     /usr/sbin
95
96 # changing CFLAGS in the middle confuses confcache
97 %undefine       configure_cache
98
99 # borken on AC
100 %define         filterout_ld    -Wl,--as-needed
101
102 # causes: undefined reference to `__stack_chk_fail_local'
103 %define         filterout_c     -fstack-protector
104
105 # for some reason known only to rpm there must be "\\|" not "\|" here
106 %define         dietarch        %(echo %{_target_cpu} | sed -e 's/i.86\\|pentium.\\|athlon/i386/;s/amd64/x86_64/;s/armv.*/arm/')
107 %define         dietlibdir      %{_prefix}/lib/dietlibc/lib-%{dietarch}
108
109 %define         skip_post_check_so      '.*libdevmapper-event-lvm2.so.*'
110
111 %description
112 This package includes a number of utilities for creating, checking,
113 and repairing logical volumes.
114
115 %description -l pl.UTF-8
116 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
117 logicznych wolumenów dyskowych (LVM2).
118
119 %package initrd
120 Summary:        The new version of Logical Volume Manager for Linux - initrd version
121 Summary(pl.UTF-8):      Nowa wersja Logical Volume Managera dla Linuksa - wersja dla initrd
122 Group:          Base
123 Conflicts:      geninitrd < 10000.18
124
125 %description initrd
126 This package includes a number of utilities for creating, checking,
127 and repairing logical volumes - staticaly linked for initrd.
128
129 %description initrd -l pl.UTF-8
130 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
131 logicznych wolumenów dyskowych (LVM2) - statycznie skonsolidowane na
132 potrzeby initrd.
133
134 %package clvmd
135 Summary:        Cluster LVM daemon
136 Summary(pl.UTF-8):      Demon clustra LVM
137 Group:          Applications/System
138 Requires:       %{name} = %{version}-%{release}
139
140 %description clvmd
141 clvmd is the daemon that distributes LVM metadata updates around a
142 cluster. It must be running on all nodes in the cluster and will give
143 an error if a node in the cluster does not have this daemon running.
144
145 %description clvmd -l pl.UTF-8
146 clvmd to demon który rozprowadza zmiany meta-danych LVM po klastrze.
147 Mysi działać na wszystkich węzłach klastra i zgłosi błąd gdy jakiś
148 węzeł w klastrze nie ma tego demona uruchomionego.
149
150 %package cmirrord
151 Summary:        Cluster mirror log daemon
152 Group:          Applications/System
153 Requires:       %{name} = %{version}-%{release}
154
155 %description cmirrord
156 cmirrord is the daemon that tracks mirror log information in a
157 cluster. It is specific to device-mapper based mirrors (and by
158 extension, LVM cluster mirrors). Cluster mirrors are not possible
159 without this daemon running.
160
161 This daemon relies on the cluster infrastructure provided by the
162 Cluster MANager (CMAN), which must be set up and running in order for
163 cmirrord to function.
164
165 %package -n device-mapper
166 Summary:        Userspace support for the device-mapper
167 Summary(pl.UTF-8):      Wsparcie dla mapowania urządzeń w przestrzeni użytkownika
168 Group:          Base
169 Requires(post,preun,postun):    systemd-units >= 38
170 Requires:       systemd-units >= 38
171
172 %description -n device-mapper
173 The goal of this driver is to support volume management. The driver
174 enables the definition of new block devices composed of ranges of
175 sectors of existing devices. This can be used to define disk
176 partitions - or logical volumes. This light-weight kernel component
177 can support user-space tools for logical volume management.
178
179 %description -n device-mapper -l pl.UTF-8
180 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
181 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
182 sektorów na istniejących urządzeniach. Może to być wykorzystane do
183 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
184 składnik jądra może wspierać działające w przestrzeni użytkownika
185 narzędzia do zarządzania logicznymi wolumenami.
186
187 %package -n device-mapper-devel
188 Summary:        Header files and development documentation for %{name}
189 Summary(pl.UTF-8):      Pliki nagłówkowe i dokumentacja do %{name}
190 Group:          Development/Libraries
191 Requires:       device-mapper = %{version}-%{release}
192 %if %{with selinux}
193 Requires:       libselinux-devel
194 Requires:       libsepol-devel
195 %endif
196
197 %description -n device-mapper-devel
198 Header files and development documentation for %{name}.
199
200 %description -n device-mapper-devel -l pl.UTF-8
201 Pliki nagłówkowe i dokumentacja do %{name}.
202
203 %package -n device-mapper-static
204 Summary:        Static devmapper library
205 Summary(pl.UTF-8):      Statyczna biblioteka devmapper
206 License:        LGPL v2.1
207 Group:          Development/Libraries
208 Requires:       device-mapper-devel = %{version}-%{release}
209
210 %description -n device-mapper-static
211 Static devmapper library.
212
213 %description -n device-mapper-static -l pl.UTF-8
214 Statyczna biblioteka devmapper.
215
216 %package -n device-mapper-dietlibc
217 Summary:        Static devmapper library built with dietlibc
218 Summary(pl.UTF-8):      Statyczna biblioteka devmapper zbudowana z dietlibc
219 License:        LGPL v2.1
220 Group:          Development/Libraries
221 Requires:       device-mapper-devel = %{version}-%{release}
222
223 %description -n device-mapper-dietlibc
224 Static devmapper library built with dietlibc.
225
226 %description -n device-mapper-dietlibc -l pl.UTF-8
227 Statyczna biblioteka devmapper zbudowana z dietlibc.
228
229 %package -n device-mapper-initrd
230 Summary:        Userspace support for the device-mapper - initrd version
231 Summary(pl.UTF-8):      Wsparcie dla mapowania urządzeń w przestrzeni użytkownika - wersja dla initrd
232 Group:          Base
233 Obsoletes:      device-mapper-initrd-devel
234 Conflicts:      geninitrd < 10000.10
235
236 %description -n device-mapper-initrd
237 The goal of this driver is to support volume management. The driver
238 enables the definition of new block devices composed of ranges of
239 sectors of existing devices. This can be used to define disk
240 partitions - or logical volumes. This light-weight kernel component
241 can support user-space tools for logical volume management.
242
243 This package contains dmsetup program linked staticaly for use in
244 initrd.
245
246 %description -n device-mapper-initrd -l pl.UTF-8
247 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
248 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
249 sektorów na istniejących urządzeniach. Może to być wykorzystane do
250 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
251 składnik jądra może wspierać działające w przestrzeni użytkownika
252 narzędzia do zarządzania logicznymi wolumenami.
253
254 Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
255 potrzeby initrd.
256
257 %prep
258 %setup -q -n LVM2.%{version}
259 %{?with_selinux:%patch0 -p1}
260 %patch1 -p1
261 %patch2 -p1
262 %patch3 -p1
263 %patch4 -p1
264 %patch5 -p1
265 %patch6 -p1
266 %patch7 -p1
267 %patch8 -p1
268
269 # do not force --export-symbol linker option for e.g. statically linked executables
270 # -rdynamic compiler option drives linker in the right way.
271 %{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
272
273 %build
274 %if %{with initrd}
275 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
276 %endif
277 cp -f /usr/share/automake/config.sub autoconf
278 %{__aclocal}
279 %{__autoconf}
280
281 %if %{with initrd}
282 %{?with_glibc:export CC="%{__cc}"}
283 %{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
284 %{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
285
286 %configure \
287         ac_cv_lib_dl_dlopen=no \
288         %{?with_uClibc:ac_cv_func_siginterrupt=no} \
289         %{?debug:--enable-debug} \
290         --with-optimisation="%{rpmcflags} -Os" \
291         --enable-static_link \
292         --with-lvm1=internal \
293         --disable-selinux \
294         --%{?with_glibc:en}%{!?with_glibc:dis}able-selinux \
295         --disable-readline \
296         --disable-nls
297 # glibc version links with normal static libdevicemapper which has selinux enabled
298 # and we need to keep these in sync between device-mapper and lvm2
299
300 %{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
301 %{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
302
303 %{__make} -j1 -C include
304 %{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
305 %{__make} -j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=
306 %{__make} -j1 -C libdaemon/client LIB_SHARED= VERSIONED_SHLIB=
307 %{__make} -j1 -C tools dmsetup.static lvm.static %{?with_dietlibc:DIETLIBC_LIBS="-lcompat"}
308 mv -f tools/lvm.static initrd-lvm
309 mv -f tools/dmsetup.static initrd-dmsetup
310
311 # check if tools works
312 for tool in initrd-lvm initrd-dmsetup; do
313         LVM_SYSTEM_DIR=$(pwd) ./$tool help && rc=$? || rc=$?
314         if [ $rc -gt 127 ]; then
315                 echo >&2 "Unexpected failure (exit status: $rc) from $tool. Does this tool work?!"
316                 exit 1
317         fi
318 done
319
320
321 %{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
322 %{__make} clean
323
324 unset CC
325 %endif
326
327 %configure \
328         --with-usrlibdir=%{_libdir} \
329         %{?debug:--enable-debug} \
330         --with-optimisation="%{rpmcflags}" \
331         --enable-readline \
332         --enable-fsadm \
333         --enable-applib \
334         --enable-cmdlib \
335         %{?with_lvmetad:--enable-lvmetad} \
336         --enable-dmeventd \
337         --with-dmeventd-path=%{_sbindir}/dmeventd \
338         --enable-pkgconfig \
339         --enable-udev_sync \
340         --enable-udev_rules \
341 %if %{with cluster}
342         --with-clvmd=corosync \
343         --enable-cmirrord \
344 %endif
345         --with-lvm1=internal \
346         --with-pool=internal \
347         --with-cluster=internal \
348         --with-snapshots=internal \
349         --with-mirrors=internal \
350         --with-thin=internal \
351         --with-thin-check="" \
352         --with-interface=ioctl \
353         --with-udev-prefix=/ \
354         --with-systemd_dir=%{systemdunitdir} \
355         %{!?with_selinux:--disable-selinux}
356
357 %{__make} -j1
358 %{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
359
360 %install
361 rm -rf $RPM_BUILD_ROOT
362 install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm,/etc/sysconfig}
363 %{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
364
365 %{__make} install install_system_dirs install_systemd_units install_initscripts \
366         DESTDIR=$RPM_BUILD_ROOT \
367         OWNER="" \
368         GROUP=""
369
370 install -d $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
371 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
372
373 %if %{with cluster}
374 install %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/clvmd.service
375 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/clvmd
376 %endif
377
378 mv $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
379 for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
380         lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
381         slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
382         ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
383 done
384
385 touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
386
387 %if %{with initrd}
388 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
389 install -p initrd-lvm $RPM_BUILD_ROOT%{_libdir}/initrd/lvm
390 install -p initrd-dmsetup $RPM_BUILD_ROOT%{_libdir}/initrd/dmsetup
391
392 %{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
393 %endif
394
395 cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
396
397 %clean
398 rm -rf $RPM_BUILD_ROOT
399
400 %post
401 /sbin/chkconfig --add lvm2-monitor
402 %service lvm2-monitor restart
403 %systemd_post lvm2-monitor.service
404 /sbin/chkconfig --add blk-availability
405 # no service blk-availability restart
406 %systemd_post blk-availability.service
407
408 %preun
409 %systemd_preun lvm2-monitor.service
410 %systemd_preun blk-availability.service
411
412 %postun
413 if [ "$1" = "0" ]; then
414         %service lvm2-monitor stop
415         /sbin/chkconfig --del lvm2-monitor
416         #no service blk-availability stop
417         /sbin/chkconfig --del blk-availability
418 fi
419 %systemd_reload
420
421 %triggerpostun -- %{name} < 2.02.94-1
422 %systemd_trigger lvm2-monitor.service
423
424 %post -n device-mapper
425 /sbin/ldconfig
426 %systemd_post dm-event.socket
427
428 %preun -n device-mapper
429 %systemd_preun dm-event.socket dm-event.service
430
431 %postun -n device-mapper
432 /sbin/ldconfig
433 %systemd_reload
434
435 %triggerpostun -n device-mapper -- device-mapper < 2.02.94-1
436 %systemd_trigger dm-event.socket
437
438 %post clvmd
439 /sbin/chkconfig --add clvmd
440 # no service restart - it breaks current locks!
441 export NORESTART=1
442 %systemd_post clvmd.service
443 # re-exec instead
444 /usr/sbin/clvmd -S 2>/dev/null || :
445
446 %preun clvmd
447 %systemd_preun clvmd.service
448
449 %postun clvmd
450 if [ "$1" = "0" ]; then
451         %service clvmd stop
452         /sbin/chkconfig --del clvmd
453 fi
454 %systemd_reload
455
456 %files
457 %defattr(644,root,root,755)
458 %doc README WHATS_NEW doc/*
459 %attr(755,root,root) %{_sbindir}/blkdeactivate
460 %attr(755,root,root) %{_sbindir}/fsadm
461 %attr(755,root,root) %{_sbindir}/lv*
462 %attr(755,root,root) %{_sbindir}/pv*
463 %attr(755,root,root) %{_sbindir}/vg*
464 %{_mandir}/man5/lvm.conf.5*
465 %{_mandir}/man8/blkdeactivate.8*
466 %{_mandir}/man8/fsadm.8*
467 %{_mandir}/man8/lv*.8*
468 %{_mandir}/man8/pv*.8*
469 %{_mandir}/man8/vg*.8*
470 %attr(750,root,root) %dir %{_sysconfdir}/lvm
471 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
472 %{_sysconfdir}/tmpfiles.d/lvm2.conf
473 %{systemdunitdir}/lvm2-monitor.service
474 %{systemdunitdir}/blk-availability.service
475 %dir %{_sysconfdir}/lvm/cache
476 %ghost %{_sysconfdir}/lvm/cache/.cache
477 %attr(754,root,root) /etc/rc.d/init.d/blk-availability
478 %attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
479 %dir %attr(700,root,root) /var/run/lvm
480
481 %if %{with cluster}
482 %files clvmd
483 %defattr(644,root,root,755)
484 %attr(755,root,root) %{_usrsbindir}/clvmd
485 %attr(754,root,root) /etc/rc.d/init.d/clvmd
486 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clvmd
487 %{systemdunitdir}/clvmd.service
488 %{_mandir}/man8/clvmd.8*
489
490 %files cmirrord
491 %defattr(644,root,root,755)
492 %attr(755,root,root) %{_usrsbindir}/cmirrord
493 %{_mandir}/man8/cmirrord.8*
494 %attr(754,root,root) /etc/rc.d/init.d/cmirrord
495 %endif
496
497 %files -n device-mapper
498 %defattr(644,root,root,755)
499 %doc *_DM
500 %{systemdunitdir}/dm-event.service
501 %{systemdunitdir}/dm-event.socket
502 /lib/udev/rules.d/10-dm.rules
503 /lib/udev/rules.d/11-dm-lvm.rules
504 /lib/udev/rules.d/13-dm-disk.rules
505 /lib/udev/rules.d/95-dm-notify.rules
506 %attr(755,root,root) %{_sbindir}/dmeventd
507 %attr(755,root,root) %{_sbindir}/dmsetup
508 %attr(755,root,root) /%{_lib}/libdevmapper*.so.*.*
509 %attr(755,root,root) /%{_lib}/liblvm2app.so.*.*
510 %attr(755,root,root) /%{_lib}/liblvm2cmd.so.*.*
511 %dir %{_libdir}/device-mapper
512 %attr(755,root,root) %{_libdir}/device-mapper/*.so
513 %attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
514 %{_mandir}/man8/dmsetup.8*
515 %{_mandir}/man8/dmeventd.8*
516
517 %files -n device-mapper-devel
518 %defattr(644,root,root,755)
519 %attr(755,root,root) %{_libdir}/libdevmapper.so
520 %attr(755,root,root) %{_libdir}/libdevmapper-event.so
521 %attr(755,root,root) %{_libdir}/liblvm2app.so
522 %attr(755,root,root) %{_libdir}/liblvm2cmd.so
523 %{_includedir}/libdevmapper*.h
524 %{_includedir}/lvm2app.h
525 %{_includedir}/lvm2cmd.h
526 %{_pkgconfigdir}/devmapper*.pc
527 %{_pkgconfigdir}/lvm2app.pc
528
529 %files -n device-mapper-static
530 %defattr(644,root,root,755)
531 %{_libdir}/libdevmapper*.a
532
533 %if %{with initrd}
534 %if %{with dietlibc}
535 %files -n device-mapper-dietlibc
536 %defattr(644,root,root,755)
537 %{dietlibdir}/libdevmapper.a
538 %endif
539
540 %files -n device-mapper-initrd
541 %defattr(644,root,root,755)
542 %attr(755,root,root) %{_libdir}/initrd/dmsetup
543
544 %files initrd
545 %defattr(644,root,root,755)
546 %attr(755,root,root) %{_libdir}/initrd/lvm
547 %endif
This page took 0.078811 seconds and 3 git commands to generate.