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: 3a1104e3d1dc4d5e92a40228161cd660
42 Source1: clvmd.sysconfig
43 Patch0: %{name}-selinux.patch
44 Patch1: %{name}-diet.patch
45 Patch2: device-mapper-dmsetup-export.patch
46 Patch3: %{name}-tld_init.patch
47 Patch4: dl-dlsym.patch
48 Patch6: %{name}-lvm_path.patch
49 Patch7: %{name}-clvmd_cmd_timeout.patch
50 Patch8: device-mapper-dmsetup-deps-export.patch
51 URL: http://sources.redhat.com/lvm2/
52 BuildRequires: autoconf >= 2.61
53 BuildRequires: automake
54 %{?with_selinux:BuildRequires: libselinux-devel >= 1.10}
55 %{?with_selinux:BuildRequires: libsepol-devel}
56 BuildRequires: ncurses-devel
57 BuildRequires: pkgconfig
58 BuildRequires: readline-devel
59 BuildRequires: rpmbuild(macros) >= 1.647
60 BuildRequires: udev-devel >= 1:143
63 BuildRequires: dietlibc-static >= 2:0.32-7
64 BuildConflicts: device-mapper-dietlibc
67 %{?with_selinux:BuildRequires: libselinux-static}
68 %{?with_selinux:BuildRequires: libsepol-static}
70 %{?with_glibc:BuildRequires: glibc-static}
71 %{?with_uClibc:BuildRequires: uClibc-static >= 2:0.9.29}
74 BuildRequires: corosync-devel
75 BuildRequires: dlm-devel >= 3.99.5
77 Requires(post,postun): /sbin/chkconfig
78 Requires: device-mapper >= %{version}-%{release}
79 %{?with_selinux:Requires: libselinux >= 1.10}
80 # doesn't work with 2.4 kernels
81 Requires: uname(release) >= 2.6
83 Obsoletes: lvm2-systemd
84 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
86 %define _sbindir /sbin
87 %define _usrsbindir /usr/sbin
89 # changing CFLAGS in the middle confuses confcache
90 %undefine configure_cache
93 %define filterout_ld -Wl,--as-needed
95 # causes: undefined reference to `__stack_chk_fail_local'
96 %define filterout_c -fstack-protector
98 # for some reason known only to rpm there must be "\\|" not "\|" here
99 %define dietarch %(echo %{_target_cpu} | sed -e 's/i.86\\|pentium.\\|athlon/i386/;s/amd64/x86_64/;s/armv.*/arm/')
100 %define dietlibdir %{_prefix}/lib/dietlibc/lib-%{dietarch}
102 %define skip_post_check_so '.*libdevmapper-event-lvm2.so.*'
105 This package includes a number of utilities for creating, checking,
106 and repairing logical volumes.
108 %description -l pl.UTF-8
109 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
110 logicznych wolumenów dyskowych (LVM2).
113 Summary: The new version of Logical Volume Manager for Linux - initrd version
114 Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa - wersja dla initrd
116 Conflicts: geninitrd < 10000.18
119 This package includes a number of utilities for creating, checking,
120 and repairing logical volumes - staticaly linked for initrd.
122 %description initrd -l pl.UTF-8
123 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
124 logicznych wolumenów dyskowych (LVM2) - statycznie skonsolidowane na
128 Summary: Cluster LVM daemon
129 Summary(pl.UTF-8): Demon clustra LVM
130 Group: Applications/System
131 Requires: %{name} = %{version}-%{release}
134 clvmd is the daemon that distributes LVM metadata updates around a
135 cluster. It must be running on all nodes in the cluster and will give
136 an error if a node in the cluster does not have this daemon running.
138 %description clvmd -l pl.UTF-8
139 clvmd to demon który rozprowadza zmiany meta-danych LVM po klastrze.
140 Mysi działać na wszystkich węzłach klastra i zgłosi błąd gdy jakiś
141 węzeł w klastrze nie ma tego demona uruchomionego.
144 Summary: Cluster mirror log daemon
145 Group: Applications/System
146 Requires: %{name} = %{version}-%{release}
148 %description cmirrord
149 cmirrord is the daemon that tracks mirror log information in a
150 cluster. It is specific to device-mapper based mirrors (and by
151 extension, LVM cluster mirrors). Cluster mirrors are not possible
152 without this daemon running.
154 This daemon relies on the cluster infrastructure provided by the
155 Cluster MANager (CMAN), which must be set up and running in order for
156 cmirrord to function.
158 %package resource-agents
159 Summary: OCF Resource Agents for LVM2 processes
160 Summary(pl.UTF-8): Agenci OCF do monitorowania procesów LVM2
161 Group: Applications/System
162 Requires: %{name} = %{version}-%{release}
163 Requires: resource-agents
165 %description resource-agents
166 OCF Resource Agents for LVM2 processes.
168 %description resource-agents -l pl.UTF-8
169 Agenci OCF do monitorowania procesów LVM2.
171 %package -n device-mapper
172 Summary: Userspace support for the device-mapper
173 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika
175 Requires(post,postun): /sbin/ldconfig
177 %description -n device-mapper
178 The goal of this driver is to support volume management. The driver
179 enables the definition of new block devices composed of ranges of
180 sectors of existing devices. This can be used to define disk
181 partitions - or logical volumes. This light-weight kernel component
182 can support user-space tools for logical volume management.
184 %description -n device-mapper -l pl.UTF-8
185 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
186 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
187 sektorów na istniejących urządzeniach. Może to być wykorzystane do
188 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
189 składnik jądra może wspierać działające w przestrzeni użytkownika
190 narzędzia do zarządzania logicznymi wolumenami.
192 %package -n device-mapper-devel
193 Summary: Header files and development documentation for %{name}
194 Summary(pl.UTF-8): Pliki nagłówkowe i dokumentacja do %{name}
195 Group: Development/Libraries
196 Requires: device-mapper = %{version}-%{release}
198 Requires: libselinux-devel
199 Requires: libsepol-devel
202 %description -n device-mapper-devel
203 Header files and development documentation for %{name}.
205 %description -n device-mapper-devel -l pl.UTF-8
206 Pliki nagłówkowe i dokumentacja do %{name}.
208 %package -n device-mapper-static
209 Summary: Static devmapper library
210 Summary(pl.UTF-8): Statyczna biblioteka devmapper
212 Group: Development/Libraries
213 Requires: device-mapper-devel = %{version}-%{release}
215 %description -n device-mapper-static
216 Static devmapper library.
218 %description -n device-mapper-static -l pl.UTF-8
219 Statyczna biblioteka devmapper.
221 %package -n device-mapper-dietlibc
222 Summary: Static devmapper library built with dietlibc
223 Summary(pl.UTF-8): Statyczna biblioteka devmapper zbudowana z dietlibc
225 Group: Development/Libraries
226 Requires: device-mapper-devel = %{version}-%{release}
228 %description -n device-mapper-dietlibc
229 Static devmapper library built with dietlibc.
231 %description -n device-mapper-dietlibc -l pl.UTF-8
232 Statyczna biblioteka devmapper zbudowana z dietlibc.
234 %package -n device-mapper-initrd
235 Summary: Userspace support for the device-mapper - initrd version
236 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika - wersja dla initrd
238 Obsoletes: device-mapper-initrd-devel
239 Conflicts: geninitrd < 10000.10
241 %description -n device-mapper-initrd
242 The goal of this driver is to support volume management. The driver
243 enables the definition of new block devices composed of ranges of
244 sectors of existing devices. This can be used to define disk
245 partitions - or logical volumes. This light-weight kernel component
246 can support user-space tools for logical volume management.
248 This package contains dmsetup program linked staticaly for use in
251 %description -n device-mapper-initrd -l pl.UTF-8
252 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
253 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
254 sektorów na istniejących urządzeniach. Może to być wykorzystane do
255 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
256 składnik jądra może wspierać działające w przestrzeni użytkownika
257 narzędzia do zarządzania logicznymi wolumenami.
259 Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
263 %setup -q -n LVM2.%{version}
264 %{?with_selinux:%patch0 -p1}
273 # do not force --export-symbol linker option for e.g. statically linked executables
274 # -rdynamic compiler option drives linker in the right way.
275 %{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
279 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
281 cp -f /usr/share/automake/config.sub autoconf
286 %{?with_glibc:export CC="%{__cc}"}
287 %{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
288 %{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
291 ac_cv_lib_dl_dlopen=no \
292 %{?with_uClibc:ac_cv_func_siginterrupt=no} \
293 %{?debug:--enable-debug} \
296 --enable-selinux%{!?with_glibc:=no} \
297 --enable-static_link \
298 --with-lvm1=internal \
299 --with-optimisation="%{rpmcflags} -Os"
300 # glibc version links with normal static libdevicemapper which has selinux enabled
301 # and we need to keep these in sync between device-mapper and lvm2
303 %{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
304 %{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
306 %{__make} -j1 -C include
307 %{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
308 %{__make} -j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=
309 %{__make} -j1 -C libdaemon/client LIB_SHARED= VERSIONED_SHLIB=
310 %{__make} -j1 -C tools dmsetup.static lvm.static %{?with_dietlibc:DIETLIBC_LIBS="-lcompat"}
311 mv -f tools/lvm.static initrd-lvm
312 mv -f tools/dmsetup.static initrd-dmsetup
314 # check if tools works
315 for tool in initrd-lvm initrd-dmsetup; do
316 LVM_SYSTEM_DIR=$(pwd) ./$tool help && rc=$? || rc=$?
317 if [ $rc -gt 127 ]; then
318 echo >&2 "Unexpected failure (exit status: $rc) from $tool. Does this tool work?!"
324 %{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
331 --disable-udev-systemd-background-jobs \
334 %{?debug:--enable-debug} \
337 %{?with_lvmetad:--enable-lvmetad} \
340 %{!?with_selinux:--disable-selinux} \
343 --enable-udev_rules \
344 --with-cluster=internal \
346 --with-clvmd=corosync \
349 --with-dmeventd-path=%{_sbindir}/dmeventd \
350 --with-interface=ioctl \
351 --with-lvm1=internal \
352 --with-mirrors=internal \
353 --with-optimisation="%{rpmcflags}" \
354 --with-pool=internal \
355 --with-snapshots=internal \
356 --with-thin=internal \
357 --with-thin-check=%{_sbindir}/thin_check \
358 --with-thin-dump=%{_sbindir}/thin_dump \
359 --with-thin-repair=%{_sbindir}/thin_repair \
360 --with-udev-prefix=/ \
361 --with-usrlibdir=%{_libdir}
364 %{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
367 rm -rf $RPM_BUILD_ROOT
368 install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm,/etc/sysconfig}
369 %{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
371 %{__make} install install_system_dirs install_initscripts \
372 DESTDIR=$RPM_BUILD_ROOT \
377 cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/sysconfig/clvmd
380 mv $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
381 for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
382 lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
383 slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
384 ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
387 touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
390 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
391 install -p initrd-lvm $RPM_BUILD_ROOT%{_libdir}/initrd/lvm
392 install -p initrd-dmsetup $RPM_BUILD_ROOT%{_libdir}/initrd/dmsetup
394 %{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
397 cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
400 rm -rf $RPM_BUILD_ROOT
403 /sbin/chkconfig --add lvm2-monitor
404 %service lvm2-monitor restart
405 /sbin/chkconfig --add blk-availability
408 if [ "$1" = "0" ]; then
409 %service lvm2-monitor stop
410 /sbin/chkconfig --del lvm2-monitor
411 #no service blk-availability stop
412 /sbin/chkconfig --del blk-availability
415 %post -n device-mapper
418 %postun -n device-mapper
422 /sbin/chkconfig --add clvmd
423 # no service restart - it breaks current locks!
426 /usr/sbin/clvmd -S 2>/dev/null || :
429 if [ "$1" = "0" ]; then
431 /sbin/chkconfig --del clvmd
435 %defattr(644,root,root,755)
436 %doc README WHATS_NEW doc/*
437 %attr(755,root,root) %{_sbindir}/blkdeactivate
438 %attr(755,root,root) %{_sbindir}/fsadm
439 %attr(755,root,root) %{_sbindir}/lv*
440 %attr(755,root,root) %{_sbindir}/pv*
441 %attr(755,root,root) %{_sbindir}/vg*
442 %{_mandir}/man5/lvm.conf.5*
443 %{_mandir}/man7/lvmthin.7*
444 %{_mandir}/man8/blkdeactivate.8*
445 %{_mandir}/man8/fsadm.8*
446 %{_mandir}/man8/lv*.8*
447 %{_mandir}/man8/pv*.8*
448 %{_mandir}/man8/vg*.8*
449 %attr(750,root,root) %dir %{_sysconfdir}/lvm
450 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
451 %attr(750,root,root) %dir %{_sysconfdir}/lvm/profile
452 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/command_profile_template.profile
453 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/metadata_profile_template.profile
454 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/thin-generic.profile
455 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/profile/thin-performance.profile
457 /lib/udev/rules.d/69-dm-lvm-metad.rules
459 %dir %{_sysconfdir}/lvm/cache
460 %ghost %{_sysconfdir}/lvm/cache/.cache
461 %attr(754,root,root) /etc/rc.d/init.d/blk-availability
463 %attr(754,root,root) /etc/rc.d/init.d/lvm2-lvmetad
465 %attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
466 %dir %attr(700,root,root) /var/run/lvm
470 %defattr(644,root,root,755)
471 %attr(755,root,root) %{_usrsbindir}/clvmd
472 %attr(754,root,root) /etc/rc.d/init.d/clvmd
473 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clvmd
474 %{_mandir}/man8/clvmd.8*
477 %defattr(644,root,root,755)
478 %attr(755,root,root) %{_usrsbindir}/cmirrord
479 %attr(754,root,root) /etc/rc.d/init.d/cmirrord
480 %{_mandir}/man8/cmirrord.8*
483 %files resource-agents
484 %defattr(644,root,root,755)
485 %dir %{_prefix}/lib/ocf/resource.d/lvm2
486 %attr(755,root,root) %{_prefix}/lib/ocf/resource.d/lvm2/VolumeGroup
488 %files -n device-mapper
489 %defattr(644,root,root,755)
491 /lib/udev/rules.d/10-dm.rules
492 /lib/udev/rules.d/11-dm-lvm.rules
493 /lib/udev/rules.d/13-dm-disk.rules
494 /lib/udev/rules.d/95-dm-notify.rules
495 %attr(755,root,root) %{_sbindir}/dmeventd
496 %attr(755,root,root) %{_sbindir}/dmsetup
497 %attr(755,root,root) /%{_lib}/libdevmapper*.so.*.*
498 %attr(755,root,root) /%{_lib}/liblvm2app.so.*.*
499 %attr(755,root,root) /%{_lib}/liblvm2cmd.so.*.*
500 %dir %{_libdir}/device-mapper
501 %attr(755,root,root) %{_libdir}/device-mapper/*.so
502 %attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
503 %{_mandir}/man8/dmsetup.8*
504 %{_mandir}/man8/dmeventd.8*
506 %files -n device-mapper-devel
507 %defattr(644,root,root,755)
508 %attr(755,root,root) %{_libdir}/libdevmapper.so
509 %attr(755,root,root) %{_libdir}/libdevmapper-event.so
510 %attr(755,root,root) %{_libdir}/liblvm2app.so
511 %attr(755,root,root) %{_libdir}/liblvm2cmd.so
512 %{_includedir}/libdevmapper*.h
513 %{_includedir}/lvm2app.h
514 %{_includedir}/lvm2cmd.h
515 %{_pkgconfigdir}/devmapper*.pc
516 %{_pkgconfigdir}/lvm2app.pc
518 %files -n device-mapper-static
519 %defattr(644,root,root,755)
520 %{_libdir}/libdevmapper*.a
524 %files -n device-mapper-dietlibc
525 %defattr(644,root,root,755)
526 %{dietlibdir}/libdevmapper.a
529 %files -n device-mapper-initrd
530 %defattr(644,root,root,755)
531 %attr(755,root,root) %{_libdir}/initrd/dmsetup
534 %defattr(644,root,root,755)
535 %attr(755,root,root) %{_libdir}/initrd/lvm