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