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 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 URL: http://sources.redhat.com/lvm2/
54 BuildRequires: autoconf >= 2.61
55 BuildRequires: automake
56 %{?with_selinux:BuildRequires: libselinux-devel >= 1.10}
57 %{?with_selinux:BuildRequires: libsepol-devel}
58 BuildRequires: ncurses-devel
59 BuildRequires: pkgconfig
60 BuildRequires: readline-devel
61 BuildRequires: rpmbuild(macros) >= 1.647
62 BuildRequires: udev-devel >= 143
65 BuildRequires: dietlibc-static >= 2:0.32-7
66 BuildConflicts: device-mapper-dietlibc
69 %{?with_selinux:BuildRequires: libselinux-static}
70 %{?with_selinux:BuildRequires: libsepol-static}
72 %{?with_glibc:BuildRequires: glibc-static}
73 %{?with_uClibc:BuildRequires: uClibc-static >= 2:0.9.29}
76 BuildRequires: corosync-devel
77 BuildRequires: dlm-devel >= 3.99.5
79 Requires(post,preun,postun): systemd-units >= 38
80 Requires: device-mapper >= %{version}-%{release}
81 %{?with_selinux:Requires: libselinux >= 1.10}
82 Requires: systemd-units >= 38
83 # doesn't work with 2.4 kernels
84 Requires: uname(release) >= 2.6
86 Obsoletes: lvm2-systemd
87 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
89 %define _sbindir /sbin
90 %define _usrsbindir /usr/sbin
92 # changing CFLAGS in the middle confuses confcache
93 %undefine configure_cache
96 %define filterout_ld -Wl,--as-needed
98 # causes: undefined reference to `__stack_chk_fail_local'
99 %define filterout_c -fstack-protector
101 # for some reason known only to rpm there must be "\\|" not "\|" here
102 %define dietarch %(echo %{_target_cpu} | sed -e 's/i.86\\|pentium.\\|athlon/i386/;s/amd64/x86_64/;s/armv.*/arm/')
103 %define dietlibdir %{_prefix}/lib/dietlibc/lib-%{dietarch}
105 %define skip_post_check_so '.*libdevmapper-event-lvm2.so.*'
108 This package includes a number of utilities for creating, checking,
109 and repairing logical volumes.
111 %description -l pl.UTF-8
112 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
113 logicznych wolumenów dyskowych (LVM2).
116 Summary: The new version of Logical Volume Manager for Linux - initrd version
117 Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa - wersja dla initrd
119 Conflicts: geninitrd < 10000.18
122 This package includes a number of utilities for creating, checking,
123 and repairing logical volumes - staticaly linked for initrd.
125 %description initrd -l pl.UTF-8
126 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
127 logicznych wolumenów dyskowych (LVM2) - statycznie skonsolidowane na
131 Summary: Cluster LVM daemon
132 Summary(pl.UTF-8): Demon clustra LVM
133 Group: Applications/System
134 Requires: %{name} = %{version}-%{release}
137 clvmd is the daemon that distributes LVM metadata updates around a
138 cluster. It must be running on all nodes in the cluster and will give
139 an error if a node in the cluster does not have this daemon running.
141 %description clvmd -l pl.UTF-8
142 clvmd to demon który rozprowadza zmiany meta-danych LVM po klastrze.
143 Mysi działać na wszystkich węzłach klastra i zgłosi błąd gdy jakiś
144 węzeł w klastrze nie ma tego demona uruchomionego.
147 Summary: Cluster mirror log daemon
148 Group: Applications/System
149 Requires: %{name} = %{version}-%{release}
151 %description cmirrord
152 cmirrord is the daemon that tracks mirror log information in a
153 cluster. It is specific to device-mapper based mirrors (and by
154 extension, LVM cluster mirrors). Cluster mirrors are not possible
155 without this daemon running.
157 This daemon relies on the cluster infrastructure provided by the
158 Cluster MANager (CMAN), which must be set up and running in order for
159 cmirrord to function.
161 %package -n device-mapper
162 Summary: Userspace support for the device-mapper
163 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika
165 Requires(post,preun,postun): systemd-units >= 38
166 Requires: systemd-units >= 38
168 %description -n device-mapper
169 The goal of this driver is to support volume management. The driver
170 enables the definition of new block devices composed of ranges of
171 sectors of existing devices. This can be used to define disk
172 partitions - or logical volumes. This light-weight kernel component
173 can support user-space tools for logical volume management.
175 %description -n device-mapper -l pl.UTF-8
176 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
177 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
178 sektorów na istniejących urządzeniach. Może to być wykorzystane do
179 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
180 składnik jądra może wspierać działające w przestrzeni użytkownika
181 narzędzia do zarządzania logicznymi wolumenami.
183 %package -n device-mapper-devel
184 Summary: Header files and development documentation for %{name}
185 Summary(pl.UTF-8): Pliki nagłówkowe i dokumentacja do %{name}
186 Group: Development/Libraries
187 Requires: device-mapper = %{version}-%{release}
189 Requires: libselinux-devel
190 Requires: libsepol-devel
193 %description -n device-mapper-devel
194 Header files and development documentation for %{name}.
196 %description -n device-mapper-devel -l pl.UTF-8
197 Pliki nagłówkowe i dokumentacja do %{name}.
199 %package -n device-mapper-static
200 Summary: Static devmapper library
201 Summary(pl.UTF-8): Statyczna biblioteka devmapper
203 Group: Development/Libraries
204 Requires: device-mapper-devel = %{version}-%{release}
206 %description -n device-mapper-static
207 Static devmapper library.
209 %description -n device-mapper-static -l pl.UTF-8
210 Statyczna biblioteka devmapper.
212 %package -n device-mapper-dietlibc
213 Summary: Static devmapper library built with dietlibc
214 Summary(pl.UTF-8): Statyczna biblioteka devmapper zbudowana z dietlibc
216 Group: Development/Libraries
217 Requires: device-mapper-devel = %{version}-%{release}
219 %description -n device-mapper-dietlibc
220 Static devmapper library built with dietlibc.
222 %description -n device-mapper-dietlibc -l pl.UTF-8
223 Statyczna biblioteka devmapper zbudowana z dietlibc.
225 %package -n device-mapper-initrd
226 Summary: Userspace support for the device-mapper - initrd version
227 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika - wersja dla initrd
229 Obsoletes: device-mapper-initrd-devel
230 Conflicts: geninitrd < 10000.10
232 %description -n device-mapper-initrd
233 The goal of this driver is to support volume management. The driver
234 enables the definition of new block devices composed of ranges of
235 sectors of existing devices. This can be used to define disk
236 partitions - or logical volumes. This light-weight kernel component
237 can support user-space tools for logical volume management.
239 This package contains dmsetup program linked staticaly for use in
242 %description -n device-mapper-initrd -l pl.UTF-8
243 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
244 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
245 sektorów na istniejących urządzeniach. Może to być wykorzystane do
246 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
247 składnik jądra może wspierać działające w przestrzeni użytkownika
248 narzędzia do zarządzania logicznymi wolumenami.
250 Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
254 %setup -q -n LVM2.%{version}
255 %{?with_selinux:%patch0 -p1}
263 # do not force --export-symbol linker option for e.g. statically linked executables
264 # -rdynamic compiler option drives linker in the right way.
265 %{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
269 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
271 cp -f /usr/share/automake/config.sub autoconf
276 %{?with_glibc:export CC="%{__cc}"}
277 %{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
278 %{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
281 ac_cv_lib_dl_dlopen=no \
282 %{?with_uClibc:ac_cv_func_siginterrupt=no} \
283 %{?debug:--enable-debug} \
284 --with-optimisation="%{rpmcflags} -Os" \
285 --enable-static_link \
286 --with-lvm1=internal \
288 --%{?with_glibc:en}%{!?with_glibc:dis}able-selinux \
291 # glibc version links with normal static libdevicemapper which has selinux enabled
292 # and we need to keep these in sync between device-mapper and lvm2
294 %{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
295 %{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
297 %{__make} -j1 -C include
298 %{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
299 %{__make} -j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=
300 %{__make} -j1 -C libdaemon/client LIB_SHARED= VERSIONED_SHLIB=
301 %{__make} -j1 -C tools dmsetup.static lvm.static %{?with_dietlibc:DIETLIBC_LIBS="-lcompat"}
302 mv -f tools/lvm.static initrd-lvm
303 mv -f tools/dmsetup.static initrd-dmsetup
305 # check if tools works
306 for tool in initrd-lvm initrd-dmsetup; do
307 LVM_SYSTEM_DIR=$(pwd) ./$tool help && rc=$? || rc=$?
308 if [ $rc -gt 127 ]; then
309 echo >&2 "Unexpected failure (exit status: $rc) from $tool. Does this tool work?!"
315 %{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
322 --with-usrlibdir=%{_libdir} \
323 %{?debug:--enable-debug} \
324 --with-optimisation="%{rpmcflags}" \
329 %{?with_lvmetad:--enable-lvmetad} \
331 --with-dmeventd-path=%{_sbindir}/dmeventd \
334 --enable-udev_rules \
336 --with-clvmd=corosync \
339 --with-lvm1=internal \
340 --with-pool=internal \
341 --with-cluster=internal \
342 --with-snapshots=internal \
343 --with-mirrors=internal \
344 --with-thin=internal \
345 --with-thin-check="" \
346 --with-interface=ioctl \
347 --with-udev-prefix=/ \
348 --with-systemd_dir=%{systemdunitdir} \
349 %{!?with_selinux:--disable-selinux}
352 %{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
355 rm -rf $RPM_BUILD_ROOT
356 install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm,/etc/sysconfig}
357 %{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
359 %{__make} install install_system_dirs install_systemd_units install_initscripts \
360 DESTDIR=$RPM_BUILD_ROOT \
364 install -d $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
365 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
368 install %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/clvmd.service
369 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/clvmd
372 mv $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
373 for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
374 lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
375 slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
376 ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
379 touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
382 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
383 install -p initrd-lvm $RPM_BUILD_ROOT%{_libdir}/initrd/lvm
384 install -p initrd-dmsetup $RPM_BUILD_ROOT%{_libdir}/initrd/dmsetup
386 %{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
389 cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
392 rm -rf $RPM_BUILD_ROOT
395 /sbin/chkconfig --add lvm2-monitor
396 %service lvm2-monitor restart
397 %systemd_post lvm2-monitor.service
398 /sbin/chkconfig --add blk-availability
399 # no service blk-availability restart
400 %systemd_post blk-availability.service
403 %systemd_preun lvm2-monitor.service
404 %systemd_preun blk-availability.service
407 if [ "$1" = "0" ]; then
408 %service lvm2-monitor stop
409 /sbin/chkconfig --del lvm2-monitor
410 #no service blk-availability stop
411 /sbin/chkconfig --del blk-availability
415 %triggerpostun -- %{name} < 2.02.94-1
416 %systemd_trigger lvm2-monitor.service
418 %post -n device-mapper
420 %systemd_post dm-event.socket
422 %preun -n device-mapper
423 %systemd_preun dm-event.socket dm-event.service
425 %postun -n device-mapper
429 %triggerpostun -n device-mapper -- device-mapper < 2.02.94-1
430 %systemd_trigger dm-event.socket
433 /sbin/chkconfig --add clvmd
434 # no service restart - it breaks current locks!
436 %systemd_post clvmd.service
438 /usr/sbin/clvmd -S 2>/dev/null || :
441 %systemd_preun clvmd.service
444 if [ "$1" = "0" ]; then
446 /sbin/chkconfig --del clvmd
451 %defattr(644,root,root,755)
452 %doc README WHATS_NEW doc/*
453 %attr(755,root,root) %{_sbindir}/blkdeactivate
454 %attr(755,root,root) %{_sbindir}/fsadm
455 %attr(755,root,root) %{_sbindir}/lv*
456 %attr(755,root,root) %{_sbindir}/pv*
457 %attr(755,root,root) %{_sbindir}/vg*
458 %{_mandir}/man5/lvm.conf.5*
459 %{_mandir}/man8/blkdeactivate.8*
460 %{_mandir}/man8/fsadm.8*
461 %{_mandir}/man8/lv*.8*
462 %{_mandir}/man8/pv*.8*
463 %{_mandir}/man8/vg*.8*
464 %attr(750,root,root) %dir %{_sysconfdir}/lvm
465 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
466 %{_sysconfdir}/tmpfiles.d/lvm2.conf
467 %{systemdunitdir}/lvm2-monitor.service
468 %{systemdunitdir}/blk-availability.service
469 %dir %{_sysconfdir}/lvm/cache
470 %ghost %{_sysconfdir}/lvm/cache/.cache
471 %attr(754,root,root) /etc/rc.d/init.d/blk-availability
472 %attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
473 %dir %attr(700,root,root) /var/run/lvm
477 %defattr(644,root,root,755)
478 %attr(755,root,root) %{_usrsbindir}/clvmd
479 %attr(754,root,root) /etc/rc.d/init.d/clvmd
480 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clvmd
481 %{systemdunitdir}/clvmd.service
482 %{_mandir}/man8/clvmd.8*
485 %defattr(644,root,root,755)
486 %attr(755,root,root) %{_usrsbindir}/cmirrord
487 %{_mandir}/man8/cmirrord.8*
488 %attr(754,root,root) /etc/rc.d/init.d/cmirrord
491 %files -n device-mapper
492 %defattr(644,root,root,755)
494 %{systemdunitdir}/dm-event.service
495 %{systemdunitdir}/dm-event.socket
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