2 # - vgscan --ignorelocking failure creates /var/lock/lvm (even if /var is not yet mounted)
3 # - --with-replicators (=internal/shared/none, default is none)?
6 %bcond_with initrd # don't build initrd version
7 %bcond_without uClibc # link initrd version with uClibc
8 %bcond_with dietlibc # link initrd version with dietlibc
9 %bcond_with glibc # link initrd version with static GLIBC
10 %bcond_without cluster # disable all cluster support (clvmd&cmirrord)
11 %bcond_without lvmetad # disable lvmetad
12 %bcond_without selinux # disable SELinux
18 # if one of the *libc is enabled disable default dietlibc
19 %if %{with dietlibc} && %{with uClibc}
20 %undefine with_dietlibc
23 # with glibc disables default dietlibc
24 %if %{with glibc} && %{with dietlibc}
25 %undefine with_dietlibc
28 # fallback is glibc if neither alternatives are enabled
29 %if %{without dietlibc} && %{without uClibc}
33 Summary: The new version of Logical Volume Manager for Linux
34 Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa
38 License: GPL v2 and LGPL v2.1
39 Group: Applications/System
40 Source0: ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz
41 # Source0-md5: b5b3540661fc70bf329b526c1cfbcf3a
42 Source1: %{name}-tmpfiles.conf
43 Source2: clvmd.service
44 Source3: clvmd.sysconfig
45 Patch0: %{name}-selinux.patch
46 Patch1: %{name}-diet.patch
47 Patch2: device-mapper-dmsetup-export.patch
48 Patch3: %{name}-pld_init.patch
49 Patch4: dl-dlsym.patch
50 Patch5: %{name}-wrapper.patch
51 Patch6: %{name}-lvm_path.patch
52 Patch7: %{name}-sd_notify.patch
53 Patch8: %{name}-clvmd_cmd_timeout.patch
54 Patch9: device-mapper-dmsetup-deps-export.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 >= 1:143
67 BuildRequires: dietlibc-static >= 2:0.32-7
68 BuildConflicts: device-mapper-dietlibc
71 %{?with_selinux:BuildRequires: libselinux-static}
72 %{?with_selinux:BuildRequires: libsepol-static}
74 %{?with_glibc:BuildRequires: glibc-static}
75 %{?with_uClibc:BuildRequires: uClibc-static >= 2:0.9.29}
78 BuildRequires: corosync-devel
79 BuildRequires: dlm-devel >= 3.99.5
80 BuildRequires: systemd-devel
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
90 Obsoletes: lvm2-systemd
91 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
93 %define _sbindir /sbin
94 %define _usrsbindir /usr/sbin
96 # changing CFLAGS in the middle confuses confcache
97 %undefine configure_cache
100 %define filterout_ld -Wl,--as-needed
102 # causes: undefined reference to `__stack_chk_fail_local'
103 %define filterout_c -fstack-protector
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}
109 %define skip_post_check_so '.*libdevmapper-event-lvm2.so.*'
112 This package includes a number of utilities for creating, checking,
113 and repairing logical volumes.
115 %description -l pl.UTF-8
116 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
117 logicznych wolumenów dyskowych (LVM2).
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
123 Conflicts: geninitrd < 10000.18
126 This package includes a number of utilities for creating, checking,
127 and repairing logical volumes - staticaly linked for initrd.
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
135 Summary: Cluster LVM daemon
136 Summary(pl.UTF-8): Demon clustra LVM
137 Group: Applications/System
138 Requires: %{name} = %{version}-%{release}
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.
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.
151 Summary: Cluster mirror log daemon
152 Group: Applications/System
153 Requires: %{name} = %{version}-%{release}
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.
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.
165 %package resource-agents
166 Summary: OCF Resource Agents for LVM2 processes
167 Summary(pl.UTF-8): Agenci OCF do monitorowania procesów LVM2
168 Group: Applications/System
169 Requires: %{name} = %{version}-%{release}
170 Requires: resource-agents
172 %description resource-agents
173 OCF Resource Agents for LVM2 processes.
175 %description resource-agents -l pl.UTF-8
176 Agenci OCF do monitorowania procesów LVM2.
178 %package -n device-mapper
179 Summary: Userspace support for the device-mapper
180 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika
182 Requires(post,postun): /sbin/ldconfig
183 Requires(post,preun,postun): systemd-units >= 38
184 Requires: systemd-units >= 38
186 %description -n device-mapper
187 The goal of this driver is to support volume management. The driver
188 enables the definition of new block devices composed of ranges of
189 sectors of existing devices. This can be used to define disk
190 partitions - or logical volumes. This light-weight kernel component
191 can support user-space tools for logical volume management.
193 %description -n device-mapper -l pl.UTF-8
194 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
195 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
196 sektorów na istniejących urządzeniach. Może to być wykorzystane do
197 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
198 składnik jądra może wspierać działające w przestrzeni użytkownika
199 narzędzia do zarządzania logicznymi wolumenami.
201 %package -n device-mapper-devel
202 Summary: Header files and development documentation for %{name}
203 Summary(pl.UTF-8): Pliki nagłówkowe i dokumentacja do %{name}
204 Group: Development/Libraries
205 Requires: device-mapper = %{version}-%{release}
207 Requires: libselinux-devel
208 Requires: libsepol-devel
211 %description -n device-mapper-devel
212 Header files and development documentation for %{name}.
214 %description -n device-mapper-devel -l pl.UTF-8
215 Pliki nagłówkowe i dokumentacja do %{name}.
217 %package -n device-mapper-static
218 Summary: Static devmapper library
219 Summary(pl.UTF-8): Statyczna biblioteka devmapper
221 Group: Development/Libraries
222 Requires: device-mapper-devel = %{version}-%{release}
224 %description -n device-mapper-static
225 Static devmapper library.
227 %description -n device-mapper-static -l pl.UTF-8
228 Statyczna biblioteka devmapper.
230 %package -n device-mapper-dietlibc
231 Summary: Static devmapper library built with dietlibc
232 Summary(pl.UTF-8): Statyczna biblioteka devmapper zbudowana z dietlibc
234 Group: Development/Libraries
235 Requires: device-mapper-devel = %{version}-%{release}
237 %description -n device-mapper-dietlibc
238 Static devmapper library built with dietlibc.
240 %description -n device-mapper-dietlibc -l pl.UTF-8
241 Statyczna biblioteka devmapper zbudowana z dietlibc.
243 %package -n device-mapper-initrd
244 Summary: Userspace support for the device-mapper - initrd version
245 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika - wersja dla initrd
247 Obsoletes: device-mapper-initrd-devel
248 Conflicts: geninitrd < 10000.10
250 %description -n device-mapper-initrd
251 The goal of this driver is to support volume management. The driver
252 enables the definition of new block devices composed of ranges of
253 sectors of existing devices. This can be used to define disk
254 partitions - or logical volumes. This light-weight kernel component
255 can support user-space tools for logical volume management.
257 This package contains dmsetup program linked staticaly for use in
260 %description -n device-mapper-initrd -l pl.UTF-8
261 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
262 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
263 sektorów na istniejących urządzeniach. Może to być wykorzystane do
264 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
265 składnik jądra może wspierać działające w przestrzeni użytkownika
266 narzędzia do zarządzania logicznymi wolumenami.
268 Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
272 %setup -q -n LVM2.%{version}
273 %{?with_selinux:%patch0 -p1}
284 # do not force --export-symbol linker option for e.g. statically linked executables
285 # -rdynamic compiler option drives linker in the right way.
286 %{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
290 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
292 cp -f /usr/share/automake/config.sub autoconf
297 %{?with_glibc:export CC="%{__cc}"}
298 %{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
299 %{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
302 ac_cv_lib_dl_dlopen=no \
303 %{?with_uClibc:ac_cv_func_siginterrupt=no} \
304 %{?debug:--enable-debug} \
307 --enable-selinux%{!?with_glibc:=no} \
308 --enable-static_link \
309 --with-lvm1=internal \
310 --with-optimisation="%{rpmcflags} -Os"
311 # glibc version links with normal static libdevicemapper which has selinux enabled
312 # and we need to keep these in sync between device-mapper and lvm2
314 %{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
315 %{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
317 %{__make} -j1 -C include
318 %{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
319 %{__make} -j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=
320 %{__make} -j1 -C libdaemon/client LIB_SHARED= VERSIONED_SHLIB=
321 %{__make} -j1 -C tools dmsetup.static lvm.static %{?with_dietlibc:DIETLIBC_LIBS="-lcompat"}
322 mv -f tools/lvm.static initrd-lvm
323 mv -f tools/dmsetup.static initrd-dmsetup
325 # check if tools works
326 for tool in initrd-lvm initrd-dmsetup; do
327 LVM_SYSTEM_DIR=$(pwd) ./$tool help && rc=$? || rc=$?
328 if [ $rc -gt 127 ]; then
329 echo >&2 "Unexpected failure (exit status: $rc) from $tool. Does this tool work?!"
335 %{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
344 %{?debug:--enable-debug} \
347 %{?with_lvmetad:--enable-lvmetad} \
350 %{!?with_selinux:--disable-selinux} \
353 --enable-udev_rules \
354 --with-cluster=internal \
356 --with-clvmd=corosync \
359 --with-dmeventd-path=%{_sbindir}/dmeventd \
360 --with-interface=ioctl \
361 --with-lvm1=internal \
362 --with-mirrors=internal \
363 --with-optimisation="%{rpmcflags}" \
364 --with-pool=internal \
365 --with-snapshots=internal \
366 --with-systemdsystemunitdir=%{systemdunitdir} \
367 --with-thin=internal \
368 --with-thin-check=%{_sbindir}/thin_check \
369 --with-thin-dump=%{_sbindir}/thin_dump \
370 --with-thin-repair=%{_sbindir}/thin_repair \
371 --with-udev-prefix=/ \
372 --with-usrlibdir=%{_libdir}
375 %{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
378 rm -rf $RPM_BUILD_ROOT
379 install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm,/etc/sysconfig}
380 %{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
382 %{__make} install install_system_dirs install_systemd_units install_initscripts \
383 DESTDIR=$RPM_BUILD_ROOT \
387 install -d $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
388 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
391 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/clvmd.service
392 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/clvmd
395 mv $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
396 for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
397 lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
398 slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
399 ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
402 touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
405 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
406 install -p initrd-lvm $RPM_BUILD_ROOT%{_libdir}/initrd/lvm
407 install -p initrd-dmsetup $RPM_BUILD_ROOT%{_libdir}/initrd/dmsetup
409 %{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
412 cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
415 rm -rf $RPM_BUILD_ROOT
418 /sbin/chkconfig --add lvm2-monitor
419 %service lvm2-monitor restart
420 %systemd_post lvm2-monitor.service
421 /sbin/chkconfig --add blk-availability
422 # no service blk-availability restart
423 %systemd_post blk-availability.service
426 %systemd_preun lvm2-monitor.service
427 %systemd_preun blk-availability.service
430 if [ "$1" = "0" ]; then
431 %service lvm2-monitor stop
432 /sbin/chkconfig --del lvm2-monitor
433 #no service blk-availability stop
434 /sbin/chkconfig --del blk-availability
438 %triggerpostun -- %{name} < 2.02.94-1
439 %systemd_trigger lvm2-monitor.service
441 %post -n device-mapper
443 %systemd_post dm-event.socket
445 %preun -n device-mapper
446 %systemd_preun dm-event.socket dm-event.service
448 %postun -n device-mapper
452 %triggerpostun -n device-mapper -- device-mapper < 2.02.94-1
453 %systemd_trigger dm-event.socket
456 /sbin/chkconfig --add clvmd
457 # no service restart - it breaks current locks!
459 %systemd_post clvmd.service
461 /usr/sbin/clvmd -S 2>/dev/null || :
464 %systemd_preun clvmd.service
467 if [ "$1" = "0" ]; then
469 /sbin/chkconfig --del clvmd
474 %defattr(644,root,root,755)
475 %doc README WHATS_NEW doc/*
476 %attr(755,root,root) %{_sbindir}/blkdeactivate
477 %attr(755,root,root) %{_sbindir}/fsadm
478 %attr(755,root,root) %{_sbindir}/lv*
479 %attr(755,root,root) %{_sbindir}/pv*
480 %attr(755,root,root) %{_sbindir}/vg*
481 %{_mandir}/man5/lvm.conf.5*
482 %{_mandir}/man8/blkdeactivate.8*
483 %{_mandir}/man8/fsadm.8*
484 %{_mandir}/man8/lv*.8*
485 %{_mandir}/man8/pv*.8*
486 %{_mandir}/man8/vg*.8*
487 %attr(750,root,root) %dir %{_sysconfdir}/lvm
488 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
489 %attr(750,root,root) %dir %{_sysconfdir}/lvm/profile
490 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/default.profile
491 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/thin-performance.profile
493 /lib/udev/rules.d/69-dm-lvm-metad.rules
495 %{_sysconfdir}/tmpfiles.d/lvm2.conf
496 %{systemdunitdir}/blk-availability.service
498 %{systemdunitdir}/lvm2-lvmetad.service
499 %{systemdunitdir}/lvm2-lvmetad.socket
501 %{systemdunitdir}/lvm2-monitor.service
502 %{systemdunitdir}/lvm2-pvscan@.service
503 %dir %{_sysconfdir}/lvm/cache
504 %ghost %{_sysconfdir}/lvm/cache/.cache
505 %attr(754,root,root) /etc/rc.d/init.d/blk-availability
507 %attr(754,root,root) /etc/rc.d/init.d/lvm2-lvmetad
509 %attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
510 %dir %attr(700,root,root) /var/run/lvm
514 %defattr(644,root,root,755)
515 %attr(755,root,root) %{_usrsbindir}/clvmd
516 %attr(754,root,root) /etc/rc.d/init.d/clvmd
517 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clvmd
518 %{systemdunitdir}/clvmd.service
519 %{_mandir}/man8/clvmd.8*
522 %defattr(644,root,root,755)
523 %attr(755,root,root) %{_usrsbindir}/cmirrord
524 %{_mandir}/man8/cmirrord.8*
525 %attr(754,root,root) /etc/rc.d/init.d/cmirrord
528 %files resource-agents
529 %defattr(644,root,root,755)
530 %dir %{_prefix}/lib/ocf/resource.d/lvm2
531 %attr(755,root,root) %{_prefix}/lib/ocf/resource.d/lvm2/VolumeGroup
533 %files -n device-mapper
534 %defattr(644,root,root,755)
536 %{systemdunitdir}/dm-event.service
537 %{systemdunitdir}/dm-event.socket
538 /lib/udev/rules.d/10-dm.rules
539 /lib/udev/rules.d/11-dm-lvm.rules
540 /lib/udev/rules.d/13-dm-disk.rules
541 /lib/udev/rules.d/95-dm-notify.rules
542 %attr(755,root,root) %{_sbindir}/dmeventd
543 %attr(755,root,root) %{_sbindir}/dmsetup
544 %attr(755,root,root) /%{_lib}/libdevmapper*.so.*.*
545 %attr(755,root,root) /%{_lib}/liblvm2app.so.*.*
546 %attr(755,root,root) /%{_lib}/liblvm2cmd.so.*.*
547 %dir %{_libdir}/device-mapper
548 %attr(755,root,root) %{_libdir}/device-mapper/*.so
549 %attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
550 %{_mandir}/man8/dmsetup.8*
551 %{_mandir}/man8/dmeventd.8*
553 %files -n device-mapper-devel
554 %defattr(644,root,root,755)
555 %attr(755,root,root) %{_libdir}/libdevmapper.so
556 %attr(755,root,root) %{_libdir}/libdevmapper-event.so
557 %attr(755,root,root) %{_libdir}/liblvm2app.so
558 %attr(755,root,root) %{_libdir}/liblvm2cmd.so
559 %{_includedir}/libdevmapper*.h
560 %{_includedir}/lvm2app.h
561 %{_includedir}/lvm2cmd.h
562 %{_pkgconfigdir}/devmapper*.pc
563 %{_pkgconfigdir}/lvm2app.pc
565 %files -n device-mapper-static
566 %defattr(644,root,root,755)
567 %{_libdir}/libdevmapper*.a
571 %files -n device-mapper-dietlibc
572 %defattr(644,root,root,755)
573 %{dietlibdir}/libdevmapper.a
576 %files -n device-mapper-initrd
577 %defattr(644,root,root,755)
578 %attr(755,root,root) %{_libdir}/initrd/dmsetup
581 %defattr(644,root,root,755)
582 %attr(755,root,root) %{_libdir}/initrd/lvm