2 # - vgscan --ignorelocking failure creates /var/lock/lvm (even if /var is not yet mounted)
3 # - Installed (but unpackaged) file(s) found:
4 # /etc/rc.d/init.d/clvmd
5 # - --with-replicators (=internal/shared/none, default is none)?
9 %bcond_without initrd # don't build initrd version
10 %bcond_without uClibc # link initrd version with uClibc
11 %bcond_with dietlibc # link initrd version with dietlibc
12 %bcond_with glibc # link initrd version with static GLIBC
13 %bcond_without clvmd # don't build clvmd
14 %bcond_with clvmd3 # build clvmd for 3rd generation of cluster
15 %bcond_with openais # enable corosync&openais managers and cmirrord
16 %bcond_without selinux # disable SELinux
22 # if one of the *libc is enabled disable default dietlibc
23 %if %{with dietlibc} && %{with uClibc}
24 %undefine with_dietlibc
27 # with glibc disables default dietlibc
28 %if %{with glibc} && %{with dietlibc}
29 %undefine with_dietlibc
32 # fallback is glibc if neither alternatives are enabled
33 %if %{without dietlibc} && %{without uClibc}
41 Summary: The new version of Logical Volume Manager for Linux
42 Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa
47 Group: Applications/System
48 Source0: ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz
49 # Source0-md5: bd470a802046c807603618a443732ea7
50 Source1: %{name}-initramfs-hook
51 Source2: %{name}-initramfs-local-top
52 Source3: %{name}-tmpfiles.conf
53 Patch0: %{name}-selinux.patch
54 Patch1: %{name}-diet.patch
55 Patch2: device-mapper-dmsetup-export.patch
56 Patch3: %{name}-clvmd_init.patch
57 Patch4: dl-dlsym.patch
58 Patch5: pldize_lvm2_monitor.patch
59 Patch6: %{name}-wrapper.patch
60 URL: http://sources.redhat.com/lvm2/
61 BuildRequires: autoconf >= 2.61
62 BuildRequires: automake
63 %{?with_selinux:BuildRequires: libselinux-devel >= 1.10}
64 %{?with_selinux:BuildRequires: libsepol-devel}
65 BuildRequires: ncurses-devel
66 BuildRequires: pkgconfig
67 BuildRequires: readline-devel
68 BuildRequires: rpmbuild(macros) >= 1.647
69 BuildRequires: udev-devel >= 143
72 BuildRequires: dietlibc-static >= 2:0.32-7
73 BuildConflicts: device-mapper-dietlibc
76 %{?with_selinux:BuildRequires: libselinux-static}
77 %{?with_selinux:BuildRequires: libsepol-static}
79 %{?with_glibc:BuildRequires: glibc-static}
80 %{?with_uClibc:BuildRequires: uClibc-static >= 2:0.9.29}
83 BuildRequires: cman-devel >= 1.0
84 BuildRequires: dlm-devel >= 1.0-0.pre21.2
87 BuildRequires: cluster-cman-devel
88 BuildRequires: cluster-dlm-devel
91 BuildRequires: corosync-devel
92 BuildRequires: openais-devel >= 1.0
94 Requires(post,preun,postun): systemd-units >= 38
95 Requires: device-mapper >= %{version}-%{release}
97 Requires: cman-libs >= 1.0
98 Requires: dlm >= 1.0-0.pre21.2
101 Requires: cluster-cman-libs
102 Requires: cluster-dlm
104 %{?with_selinux:Requires: libselinux >= 1.10}
105 Requires: systemd-units >= 38
106 # doesn't work with 2.4 kernels
107 Requires: uname(release) >= 2.6
109 Obsoletes: lvm2-systemd
110 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
112 %define _sbindir /sbin
113 %define _usrsbindir /usr/sbin
115 # changing CFLAGS in the middle confuses confcache
116 %undefine configure_cache
119 %define filterout_ld -Wl,--as-needed
121 # for some reason known only to rpm there must be "\\|" not "\|" here
122 %define dietarch %(echo %{_target_cpu} | sed -e 's/i.86\\|pentium.\\|athlon/i386/;s/amd64/x86_64/;s/armv.*/arm/')
123 %define dietlibdir %{_prefix}/lib/dietlibc/lib-%{dietarch}
125 %define skip_post_check_so '.*libdevmapper-event-lvm2.so.*'
128 This package includes a number of utilities for creating, checking,
129 and repairing logical volumes.
131 %description -l pl.UTF-8
132 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
133 logicznych wolumenów dyskowych (LVM2).
136 Summary: The new version of Logical Volume Manager for Linux - initrd version
137 Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa - wersja dla initrd
139 Conflicts: geninitrd < 10000.18
142 This package includes a number of utilities for creating, checking,
143 and repairing logical volumes - staticaly linked for initrd.
145 %description initrd -l pl.UTF-8
146 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
147 logicznych wolumenów dyskowych (LVM2) - statycznie skonsolidowane na
150 %package -n device-mapper
151 Summary: Userspace support for the device-mapper
152 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika
154 Requires(post,preun,postun): systemd-units >= 38
155 Requires: systemd-units >= 38
157 %description -n device-mapper
158 The goal of this driver is to support volume management. The driver
159 enables the definition of new block devices composed of ranges of
160 sectors of existing devices. This can be used to define disk
161 partitions - or logical volumes. This light-weight kernel component
162 can support user-space tools for logical volume management.
164 %description -n device-mapper -l pl.UTF-8
165 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
166 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
167 sektorów na istniejących urządzeniach. Może to być wykorzystane do
168 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
169 składnik jądra może wspierać działające w przestrzeni użytkownika
170 narzędzia do zarządzania logicznymi wolumenami.
172 %package -n device-mapper-devel
173 Summary: Header files and development documentation for %{name}
174 Summary(pl.UTF-8): Pliki nagłówkowe i dokumentacja do %{name}
175 Group: Development/Libraries
176 Requires: device-mapper = %{version}-%{release}
178 Requires: libselinux-devel
179 Requires: libsepol-devel
182 %description -n device-mapper-devel
183 Header files and development documentation for %{name}.
185 %description -n device-mapper-devel -l pl.UTF-8
186 Pliki nagłówkowe i dokumentacja do %{name}.
188 %package -n device-mapper-static
189 Summary: Static devmapper library
190 Summary(pl.UTF-8): Statyczna biblioteka devmapper
192 Group: Development/Libraries
193 Requires: device-mapper-devel = %{version}-%{release}
195 %description -n device-mapper-static
196 Static devmapper library.
198 %description -n device-mapper-static -l pl.UTF-8
199 Statyczna biblioteka devmapper.
201 %package -n device-mapper-dietlibc
202 Summary: Static devmapper library built with dietlibc
203 Summary(pl.UTF-8): Statyczna biblioteka devmapper zbudowana z dietlibc
205 Group: Development/Libraries
206 Requires: device-mapper-devel = %{version}-%{release}
208 %description -n device-mapper-dietlibc
209 Static devmapper library built with dietlibc.
211 %description -n device-mapper-dietlibc -l pl.UTF-8
212 Statyczna biblioteka devmapper zbudowana z dietlibc.
214 %package -n device-mapper-initrd
215 Summary: Userspace support for the device-mapper - initrd version
216 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika - wersja dla initrd
218 Obsoletes: device-mapper-initrd-devel
219 Conflicts: geninitrd < 10000.10
221 %description -n device-mapper-initrd
222 The goal of this driver is to support volume management. The driver
223 enables the definition of new block devices composed of ranges of
224 sectors of existing devices. This can be used to define disk
225 partitions - or logical volumes. This light-weight kernel component
226 can support user-space tools for logical volume management.
228 This package contains dmsetup program linked staticaly for use in
231 %description -n device-mapper-initrd -l pl.UTF-8
232 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
233 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
234 sektorów na istniejących urządzeniach. Może to być wykorzystane do
235 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
236 składnik jądra może wspierać działające w przestrzeni użytkownika
237 narzędzia do zarządzania logicznymi wolumenami.
239 Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
243 Summary: The new version of Logical Volume Manager for Linux - support scripts for initramfs-tools
244 Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa - skrypty dla initramfs-tools
246 Requires: %{name} = %{version}-%{release}
247 Requires: initramfs-tools
249 %description initramfs
250 The new version of Logical Volume Manager for Linux - support scripts
253 %description initramfs -l pl.UTF-8
254 Nowa wersja Logical Volume Managera dla Linuksa - skrypty dla
258 %setup -q -n LVM2.%{version}
259 %{?with_selinux:%patch0 -p1}
267 # do not force --export-symbol linker option for e.g. statically linked executables
268 # -rdynamic compiler option drives linker in the right way.
269 %{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
273 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
275 cp -f /usr/share/automake/config.sub autoconf
280 %{?with_glibc:export CC="%{__cc}"}
281 %{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
282 %{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
285 ac_cv_lib_dl_dlopen=no \
286 %{?with_uClibc:ac_cv_func_siginterrupt=no} \
287 %{?debug:--enable-debug} \
288 --with-optimisation="%{rpmcflags} -Os" \
289 --enable-static_link \
290 --with-lvm1=internal \
292 --%{?with_glibc:en}%{!?with_glibc:dis}able-selinux \
295 # glibc version links with normal static libdevicemapper which has selinux enabled
296 # and we need to keep these in sync between device-mapper and lvm2
298 %{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
299 %{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
301 %{__make} -j1 -C include
302 %{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
303 %{__make} -j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=
304 %{__make} -j1 -C tools dmsetup.static lvm.static %{?with_dietlibc:DIETLIBC_LIBS="-lcompat"}
305 mv -f tools/lvm.static initrd-lvm
306 mv -f tools/dmsetup.static initrd-dmsetup
308 # check if tools works
309 for tool in initrd-lvm initrd-dmsetup; do
310 LVM_SYSTEM_DIR=$(pwd) ./$tool help && rc=$? || rc=$?
311 if [ $rc -gt 127 ]; then
312 echo >&2 "Unexpected failure (exit status: $rc) from $tool. Does this tool work?!"
318 %{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
325 --with-usrlibdir=%{_libdir} \
326 %{?debug:--enable-debug} \
327 --with-optimisation="%{rpmcflags}" \
333 %{?with_openais:--enable-cmirrord} \
335 --with-dmeventd-path=%{_sbindir}/dmeventd \
338 --enable-udev_rules \
339 %{?with_clvmd:--with-clvmd=cman%{?with_openais:,corosync,openais}} \
340 --with-lvm1=internal \
341 --with-pool=internal \
342 --with-cluster=internal \
343 --with-snapshots=internal \
344 --with-mirrors=internal \
345 --with-thin=internal \
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} \
357 $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/{hooks,scripts/local-top}
358 %{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
360 %{__make} install install_system_dirs install_systemd_units install_initscripts \
361 DESTDIR=$RPM_BUILD_ROOT \
365 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
366 install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
368 mv $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
369 for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
370 lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
371 slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
372 ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
375 touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
378 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
379 install -p initrd-lvm $RPM_BUILD_ROOT%{_libdir}/initrd/lvm
380 install -p initrd-dmsetup $RPM_BUILD_ROOT%{_libdir}/initrd/dmsetup
382 %{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
385 install -p %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/hooks/lvm2
386 install -p %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/initramfs-tools/scripts/local-top/lvm2
388 cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
391 rm -rf $RPM_BUILD_ROOT
394 /sbin/chkconfig --add lvm2-monitor
395 %service lvm2-monitor restart
396 %systemd_post lvm2-monitor.service
399 %systemd_preun lvm2-monitor.service
402 if [ "$1" = "0" ]; then
403 %service lvm2-monitor stop
404 /sbin/chkconfig --del lvm2-monitor
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}/fsadm
429 %attr(755,root,root) %{_sbindir}/lv*
430 %attr(755,root,root) %{_sbindir}/pv*
431 %attr(755,root,root) %{_sbindir}/vg*
432 %{?with_clvmd:%attr(755,root,root) %{_usrsbindir}/clvmd}
433 %{_mandir}/man5/lvm.conf.5*
434 %{?with_clvmd:%{_mandir}/man8/clvmd.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 %dir %{_sysconfdir}/lvm/cache
444 %ghost %{_sysconfdir}/lvm/cache/.cache
445 %attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
446 %{?with_clvmd:%attr(754,root,root) /etc/rc.d/init.d/clvmd}
448 %files -n device-mapper
449 %defattr(644,root,root,755)
451 %{systemdunitdir}/dm-event.service
452 %{systemdunitdir}/dm-event.socket
453 /lib/udev/rules.d/10-dm.rules
454 /lib/udev/rules.d/11-dm-lvm.rules
455 /lib/udev/rules.d/13-dm-disk.rules
456 /lib/udev/rules.d/95-dm-notify.rules
457 %attr(755,root,root) %{_sbindir}/dmeventd
458 %attr(755,root,root) %{_sbindir}/dmsetup
459 %attr(755,root,root) /%{_lib}/libdevmapper*.so.*.*
460 %attr(755,root,root) /%{_lib}/liblvm2app.so.*.*
461 %attr(755,root,root) /%{_lib}/liblvm2cmd.so.*.*
462 %dir %{_libdir}/device-mapper
463 %attr(755,root,root) %{_libdir}/device-mapper/*.so
464 %attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
465 %{_mandir}/man8/dmsetup.8*
466 %{_mandir}/man8/dmeventd.8*
468 %files -n device-mapper-devel
469 %defattr(644,root,root,755)
470 %attr(755,root,root) %{_libdir}/libdevmapper.so
471 %attr(755,root,root) %{_libdir}/libdevmapper-event.so
472 %attr(755,root,root) %{_libdir}/liblvm2app.so
473 %attr(755,root,root) %{_libdir}/liblvm2cmd.so
474 %{_includedir}/libdevmapper*.h
475 %{_includedir}/lvm2app.h
476 %{_includedir}/lvm2cmd.h
477 %{_pkgconfigdir}/devmapper*.pc
478 %{_pkgconfigdir}/lvm2app.pc
480 %files -n device-mapper-static
481 %defattr(644,root,root,755)
482 %{_libdir}/libdevmapper*.a
486 %files -n device-mapper-dietlibc
487 %defattr(644,root,root,755)
488 %{dietlibdir}/libdevmapper.a
491 %files -n device-mapper-initrd
492 %defattr(644,root,root,755)
493 %attr(755,root,root) %{_libdir}/initrd/dmsetup
496 %defattr(644,root,root,755)
497 %attr(755,root,root) %{_libdir}/initrd/lvm
501 %defattr(644,root,root,755)
502 %attr(755,root,root) %{_datadir}/initramfs-tools/hooks/lvm2
503 %attr(755,root,root) %{_datadir}/initramfs-tools/scripts/local-top/lvm2