2 # - vgscan --ignorelocking failure creates /var/lock/lvm (even if /var is not yet mounted)
3 # - --with-replicators (=internal/shared/none, default is none)?
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
19 # if one of the *libc is enabled disable default dietlibc
20 %if %{with dietlibc} && %{with uClibc}
21 %undefine with_dietlibc
24 # with glibc disables default dietlibc
25 %if %{with glibc} && %{with dietlibc}
26 %undefine with_dietlibc
29 # fallback is glibc if neither alternatives are enabled
30 %if %{without dietlibc} && %{without uClibc}
34 Summary: The new version of Logical Volume Manager for Linux
35 Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa
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 Patch0: %{name}-selinux.patch
45 Patch1: %{name}-diet.patch
46 Patch2: device-mapper-dmsetup-export.patch
47 Patch3: %{name}-pld_init.patch
48 Patch4: dl-dlsym.patch
49 Patch5: %{name}-wrapper.patch
50 Patch6: %{name}-lvm_path.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 >= 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,preun,postun): systemd-units >= 38
78 Requires: device-mapper >= %{version}-%{release}
79 %{?with_selinux:Requires: libselinux >= 1.10}
80 Requires: systemd-units >= 38
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 -n device-mapper
160 Summary: Userspace support for the device-mapper
161 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika
163 Requires(post,preun,postun): systemd-units >= 38
164 Requires: systemd-units >= 38
166 %description -n device-mapper
167 The goal of this driver is to support volume management. The driver
168 enables the definition of new block devices composed of ranges of
169 sectors of existing devices. This can be used to define disk
170 partitions - or logical volumes. This light-weight kernel component
171 can support user-space tools for logical volume management.
173 %description -n device-mapper -l pl.UTF-8
174 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
175 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
176 sektorów na istniejących urządzeniach. Może to być wykorzystane do
177 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
178 składnik jądra może wspierać działające w przestrzeni użytkownika
179 narzędzia do zarządzania logicznymi wolumenami.
181 %package -n device-mapper-devel
182 Summary: Header files and development documentation for %{name}
183 Summary(pl.UTF-8): Pliki nagłówkowe i dokumentacja do %{name}
184 Group: Development/Libraries
185 Requires: device-mapper = %{version}-%{release}
187 Requires: libselinux-devel
188 Requires: libsepol-devel
191 %description -n device-mapper-devel
192 Header files and development documentation for %{name}.
194 %description -n device-mapper-devel -l pl.UTF-8
195 Pliki nagłówkowe i dokumentacja do %{name}.
197 %package -n device-mapper-static
198 Summary: Static devmapper library
199 Summary(pl.UTF-8): Statyczna biblioteka devmapper
201 Group: Development/Libraries
202 Requires: device-mapper-devel = %{version}-%{release}
204 %description -n device-mapper-static
205 Static devmapper library.
207 %description -n device-mapper-static -l pl.UTF-8
208 Statyczna biblioteka devmapper.
210 %package -n device-mapper-dietlibc
211 Summary: Static devmapper library built with dietlibc
212 Summary(pl.UTF-8): Statyczna biblioteka devmapper zbudowana z dietlibc
214 Group: Development/Libraries
215 Requires: device-mapper-devel = %{version}-%{release}
217 %description -n device-mapper-dietlibc
218 Static devmapper library built with dietlibc.
220 %description -n device-mapper-dietlibc -l pl.UTF-8
221 Statyczna biblioteka devmapper zbudowana z dietlibc.
223 %package -n device-mapper-initrd
224 Summary: Userspace support for the device-mapper - initrd version
225 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika - wersja dla initrd
227 Obsoletes: device-mapper-initrd-devel
228 Conflicts: geninitrd < 10000.10
230 %description -n device-mapper-initrd
231 The goal of this driver is to support volume management. The driver
232 enables the definition of new block devices composed of ranges of
233 sectors of existing devices. This can be used to define disk
234 partitions - or logical volumes. This light-weight kernel component
235 can support user-space tools for logical volume management.
237 This package contains dmsetup program linked staticaly for use in
240 %description -n device-mapper-initrd -l pl.UTF-8
241 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
242 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
243 sektorów na istniejących urządzeniach. Może to być wykorzystane do
244 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
245 składnik jądra może wspierać działające w przestrzeni użytkownika
246 narzędzia do zarządzania logicznymi wolumenami.
248 Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
252 %setup -q -n LVM2.%{version}
253 %{?with_selinux:%patch0 -p1}
261 # do not force --export-symbol linker option for e.g. statically linked executables
262 # -rdynamic compiler option drives linker in the right way.
263 %{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
267 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
269 cp -f /usr/share/automake/config.sub autoconf
274 %{?with_glibc:export CC="%{__cc}"}
275 %{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
276 %{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
279 ac_cv_lib_dl_dlopen=no \
280 %{?with_uClibc:ac_cv_func_siginterrupt=no} \
281 %{?debug:--enable-debug} \
282 --with-optimisation="%{rpmcflags} -Os" \
283 --enable-static_link \
284 --with-lvm1=internal \
286 --%{?with_glibc:en}%{!?with_glibc:dis}able-selinux \
289 # glibc version links with normal static libdevicemapper which has selinux enabled
290 # and we need to keep these in sync between device-mapper and lvm2
292 %{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
293 %{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
295 %{__make} -j1 -C include
296 %{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
297 %{__make} -j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=
298 %{__make} -j1 -C libdaemon/client LIB_SHARED= VERSIONED_SHLIB=
299 %{__make} -j1 -C tools dmsetup.static lvm.static %{?with_dietlibc:DIETLIBC_LIBS="-lcompat"}
300 mv -f tools/lvm.static initrd-lvm
301 mv -f tools/dmsetup.static initrd-dmsetup
303 # check if tools works
304 for tool in initrd-lvm initrd-dmsetup; do
305 LVM_SYSTEM_DIR=$(pwd) ./$tool help && rc=$? || rc=$?
306 if [ $rc -gt 127 ]; then
307 echo >&2 "Unexpected failure (exit status: $rc) from $tool. Does this tool work?!"
313 %{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
320 --with-usrlibdir=%{_libdir} \
321 %{?debug:--enable-debug} \
322 --with-optimisation="%{rpmcflags}" \
327 %{?with_lvmetad:--enable-lvmetad} \
329 --with-dmeventd-path=%{_sbindir}/dmeventd \
332 --enable-udev_rules \
334 --with-clvmd=corosync \
337 --with-lvm1=internal \
338 --with-pool=internal \
339 --with-cluster=internal \
340 --with-snapshots=internal \
341 --with-mirrors=internal \
342 --with-thin=internal \
343 --with-thin-check="" \
344 --with-interface=ioctl \
345 --with-udev-prefix=/ \
346 --with-systemd_dir=%{systemdunitdir} \
347 %{!?with_selinux:--disable-selinux}
350 %{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
353 rm -rf $RPM_BUILD_ROOT
354 install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm}
355 %{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
357 %{__make} install install_system_dirs install_systemd_units install_initscripts \
358 DESTDIR=$RPM_BUILD_ROOT \
362 install -d $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
363 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
365 mv $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
366 for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
367 lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
368 slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
369 ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
372 touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
375 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
376 install -p initrd-lvm $RPM_BUILD_ROOT%{_libdir}/initrd/lvm
377 install -p initrd-dmsetup $RPM_BUILD_ROOT%{_libdir}/initrd/dmsetup
379 %{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
382 cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
385 rm -rf $RPM_BUILD_ROOT
388 /sbin/chkconfig --add lvm2-monitor
389 %service lvm2-monitor restart
390 %systemd_post lvm2-monitor.service
391 /sbin/chkconfig --add blk-availability
392 # no service blk-availability restart
393 %systemd_post blk-availability.service
396 %systemd_preun lvm2-monitor.service
397 %systemd_preun blk-availability.service
400 if [ "$1" = "0" ]; then
401 %service lvm2-monitor stop
402 /sbin/chkconfig --del lvm2-monitor
403 #no service blk-availability stop
404 /sbin/chkconfig --del blk-availability
408 %triggerpostun -- %{name} < 2.02.94-1
409 %systemd_trigger lvm2-monitor.service
411 %post -n device-mapper
413 %systemd_post dm-event.socket
415 %preun -n device-mapper
416 %systemd_preun dm-event.socket dm-event.service
418 %postun -n device-mapper
422 %triggerpostun -n device-mapper -- device-mapper < 2.02.94-1
423 %systemd_trigger dm-event.socket
426 %defattr(644,root,root,755)
427 %doc README WHATS_NEW doc/*
428 %attr(755,root,root) %{_sbindir}/blkdeactivate
429 %attr(755,root,root) %{_sbindir}/fsadm
430 %attr(755,root,root) %{_sbindir}/lv*
431 %attr(755,root,root) %{_sbindir}/pv*
432 %attr(755,root,root) %{_sbindir}/vg*
433 %{_mandir}/man5/lvm.conf.5*
434 %{_mandir}/man8/blkdeactivate.8*
435 %{_mandir}/man8/fsadm.8*
436 %{_mandir}/man8/lv*.8*
437 %{_mandir}/man8/pv*.8*
438 %{_mandir}/man8/vg*.8*
439 %attr(750,root,root) %dir %{_sysconfdir}/lvm
440 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
441 %{_sysconfdir}/tmpfiles.d/lvm2.conf
442 %{systemdunitdir}/lvm2-monitor.service
443 %{systemdunitdir}/blk-availability.service
444 %dir %{_sysconfdir}/lvm/cache
445 %ghost %{_sysconfdir}/lvm/cache/.cache
446 %attr(754,root,root) /etc/rc.d/init.d/blk-availability
447 %attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
451 %defattr(644,root,root,755)
452 %attr(755,root,root) %{_usrsbindir}/clvmd
453 %attr(754,root,root) /etc/rc.d/init.d/clvmd
454 %{_mandir}/man8/clvmd.8*
457 %defattr(644,root,root,755)
458 %attr(755,root,root) %{_usrsbindir}/cmirrord
459 %{_mandir}/man8/cmirrord.8*
460 %attr(754,root,root) /etc/rc.d/init.d/cmirrord
463 %files -n device-mapper
464 %defattr(644,root,root,755)
466 %{systemdunitdir}/dm-event.service
467 %{systemdunitdir}/dm-event.socket
468 /lib/udev/rules.d/10-dm.rules
469 /lib/udev/rules.d/11-dm-lvm.rules
470 /lib/udev/rules.d/13-dm-disk.rules
471 /lib/udev/rules.d/95-dm-notify.rules
472 %attr(755,root,root) %{_sbindir}/dmeventd
473 %attr(755,root,root) %{_sbindir}/dmsetup
474 %attr(755,root,root) /%{_lib}/libdevmapper*.so.*.*
475 %attr(755,root,root) /%{_lib}/liblvm2app.so.*.*
476 %attr(755,root,root) /%{_lib}/liblvm2cmd.so.*.*
477 %dir %{_libdir}/device-mapper
478 %attr(755,root,root) %{_libdir}/device-mapper/*.so
479 %attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
480 %{_mandir}/man8/dmsetup.8*
481 %{_mandir}/man8/dmeventd.8*
483 %files -n device-mapper-devel
484 %defattr(644,root,root,755)
485 %attr(755,root,root) %{_libdir}/libdevmapper.so
486 %attr(755,root,root) %{_libdir}/libdevmapper-event.so
487 %attr(755,root,root) %{_libdir}/liblvm2app.so
488 %attr(755,root,root) %{_libdir}/liblvm2cmd.so
489 %{_includedir}/libdevmapper*.h
490 %{_includedir}/lvm2app.h
491 %{_includedir}/lvm2cmd.h
492 %{_pkgconfigdir}/devmapper*.pc
493 %{_pkgconfigdir}/lvm2app.pc
495 %files -n device-mapper-static
496 %defattr(644,root,root,755)
497 %{_libdir}/libdevmapper*.a
501 %files -n device-mapper-dietlibc
502 %defattr(644,root,root,755)
503 %{dietlibdir}/libdevmapper.a
506 %files -n device-mapper-initrd
507 %defattr(644,root,root,755)
508 %attr(755,root,root) %{_libdir}/initrd/dmsetup
511 %defattr(644,root,root,755)
512 %attr(755,root,root) %{_libdir}/initrd/lvm