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)?
7 # - corosync without openais?
8 # - does the 'clvmd3' bcond make sense at all - it only changes build requires
9 # and _disables_ clvmd.
12 %bcond_without initrd # don't build initrd version
13 %bcond_without uClibc # link initrd version with uClibc
14 %bcond_with dietlibc # link initrd version with dietlibc
15 %bcond_with glibc # link initrd version with static GLIBC
16 %bcond_without clvmd # don't build clvmd
17 %bcond_with clvmd3 # build clvmd for 3rd generation of cluster
18 %bcond_without cman # don't use 'cman' for clvmd
19 %bcond_with openais # enable corosync&openais managers and cmirrord
20 %bcond_with lvmetad # enable lvmetad
21 %bcond_without selinux # disable SELinux
27 # if one of the *libc is enabled disable default dietlibc
28 %if %{with dietlibc} && %{with uClibc}
29 %undefine with_dietlibc
32 # with glibc disables default dietlibc
33 %if %{with glibc} && %{with dietlibc}
34 %undefine with_dietlibc
37 # fallback is glibc if neither alternatives are enabled
38 %if %{without dietlibc} && %{without uClibc}
42 %if %{without cman} && %{without openais}
51 Summary: The new version of Logical Volume Manager for Linux
52 Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa
57 Group: Applications/System
58 Source0: ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz
59 # Source0-md5: bd470a802046c807603618a443732ea7
60 Source1: %{name}-tmpfiles.conf
61 Patch0: %{name}-selinux.patch
62 Patch1: %{name}-diet.patch
63 Patch2: device-mapper-dmsetup-export.patch
64 Patch3: %{name}-clvmd_init.patch
65 Patch4: dl-dlsym.patch
66 Patch5: pldize_lvm2_monitor.patch
67 Patch6: %{name}-wrapper.patch
68 Patch7: udev-deprecated.patch
69 URL: http://sources.redhat.com/lvm2/
70 BuildRequires: autoconf >= 2.61
71 BuildRequires: automake
72 %{?with_selinux:BuildRequires: libselinux-devel >= 1.10}
73 %{?with_selinux:BuildRequires: libsepol-devel}
74 BuildRequires: ncurses-devel
75 BuildRequires: pkgconfig
76 BuildRequires: readline-devel
77 BuildRequires: rpmbuild(macros) >= 1.647
78 BuildRequires: udev-devel >= 143
81 BuildRequires: dietlibc-static >= 2:0.32-7
82 BuildConflicts: device-mapper-dietlibc
85 %{?with_selinux:BuildRequires: libselinux-static}
86 %{?with_selinux:BuildRequires: libsepol-static}
88 %{?with_glibc:BuildRequires: glibc-static}
89 %{?with_uClibc:BuildRequires: uClibc-static >= 2:0.9.29}
92 BuildRequires: cman-devel >= 1.0
93 BuildRequires: dlm-devel >= 1.0-0.pre21.2
96 BuildRequires: cluster-cman-devel
97 BuildRequires: cluster-dlm-devel
100 BuildRequires: corosync-devel
101 BuildRequires: openais-devel >= 1.0
103 Requires(post,preun,postun): systemd-units >= 38
104 Requires: device-mapper >= %{version}-%{release}
106 Requires: cman-libs >= 1.0
107 Requires: dlm >= 1.0-0.pre21.2
110 Requires: cluster-cman-libs
111 Requires: cluster-dlm
113 %{?with_selinux:Requires: libselinux >= 1.10}
114 Requires: systemd-units >= 38
115 # doesn't work with 2.4 kernels
116 Requires: uname(release) >= 2.6
118 Obsoletes: lvm2-systemd
119 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
121 %define _sbindir /sbin
122 %define _usrsbindir /usr/sbin
124 # changing CFLAGS in the middle confuses confcache
125 %undefine configure_cache
128 %define filterout_ld -Wl,--as-needed
130 # for some reason known only to rpm there must be "\\|" not "\|" here
131 %define dietarch %(echo %{_target_cpu} | sed -e 's/i.86\\|pentium.\\|athlon/i386/;s/amd64/x86_64/;s/armv.*/arm/')
132 %define dietlibdir %{_prefix}/lib/dietlibc/lib-%{dietarch}
134 %define skip_post_check_so '.*libdevmapper-event-lvm2.so.*'
137 This package includes a number of utilities for creating, checking,
138 and repairing logical volumes.
140 %description -l pl.UTF-8
141 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
142 logicznych wolumenów dyskowych (LVM2).
145 Summary: The new version of Logical Volume Manager for Linux - initrd version
146 Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa - wersja dla initrd
148 Conflicts: geninitrd < 10000.18
151 This package includes a number of utilities for creating, checking,
152 and repairing logical volumes - staticaly linked for initrd.
154 %description initrd -l pl.UTF-8
155 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
156 logicznych wolumenów dyskowych (LVM2) - statycznie skonsolidowane na
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}
262 # do not force --export-symbol linker option for e.g. statically linked executables
263 # -rdynamic compiler option drives linker in the right way.
264 %{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
268 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
270 cp -f /usr/share/automake/config.sub autoconf
275 %{?with_glibc:export CC="%{__cc}"}
276 %{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
277 %{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
280 ac_cv_lib_dl_dlopen=no \
281 %{?with_uClibc:ac_cv_func_siginterrupt=no} \
282 %{?debug:--enable-debug} \
283 --with-optimisation="%{rpmcflags} -Os" \
284 --enable-static_link \
285 --with-lvm1=internal \
287 --%{?with_glibc:en}%{!?with_glibc:dis}able-selinux \
290 # glibc version links with normal static libdevicemapper which has selinux enabled
291 # and we need to keep these in sync between device-mapper and lvm2
293 %{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
294 %{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
296 %{__make} -j1 -C include
297 %{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
298 %{__make} -j1 -C libdm 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} \
328 %{?with_openais:--enable-cmirrord} \
330 --with-dmeventd-path=%{_sbindir}/dmeventd \
333 --enable-udev_rules \
336 --with-clvmd=cman%{?with_openais:,corosync,openais} \
339 --with-clvmd=corosync,openais \
342 --with-lvm1=internal \
343 --with-pool=internal \
344 --with-cluster=internal \
345 --with-snapshots=internal \
346 --with-mirrors=internal \
347 --with-thin=internal \
348 --with-interface=ioctl \
349 --with-udev-prefix=/ \
350 --with-systemd_dir=%{systemdunitdir} \
351 %{!?with_selinux:--disable-selinux}
354 %{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
357 rm -rf $RPM_BUILD_ROOT
358 install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm}
359 %{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
361 %{__make} install install_system_dirs install_systemd_units install_initscripts \
362 DESTDIR=$RPM_BUILD_ROOT \
366 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
367 install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
369 mv $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
370 for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
371 lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
372 slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
373 ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
376 touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
379 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
380 install -p initrd-lvm $RPM_BUILD_ROOT%{_libdir}/initrd/lvm
381 install -p initrd-dmsetup $RPM_BUILD_ROOT%{_libdir}/initrd/dmsetup
383 %{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
386 cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
389 rm -rf $RPM_BUILD_ROOT
392 /sbin/chkconfig --add lvm2-monitor
393 %service lvm2-monitor restart
394 %systemd_post lvm2-monitor.service
397 %systemd_preun lvm2-monitor.service
400 if [ "$1" = "0" ]; then
401 %service lvm2-monitor stop
402 /sbin/chkconfig --del lvm2-monitor
406 %triggerpostun -- %{name} < 2.02.94-1
407 %systemd_trigger lvm2-monitor.service
409 %post -n device-mapper
411 %systemd_post dm-event.socket
413 %preun -n device-mapper
414 %systemd_preun dm-event.socket dm-event.service
416 %postun -n device-mapper
420 %triggerpostun -n device-mapper -- device-mapper < 2.02.94-1
421 %systemd_trigger dm-event.socket
424 %defattr(644,root,root,755)
425 %doc README WHATS_NEW doc/*
426 %attr(755,root,root) %{_sbindir}/fsadm
427 %attr(755,root,root) %{_sbindir}/lv*
428 %attr(755,root,root) %{_sbindir}/pv*
429 %attr(755,root,root) %{_sbindir}/vg*
430 %{?with_clvmd:%attr(755,root,root) %{_usrsbindir}/clvmd}
431 %{?with_openais:%attr(755,root,root) %{_usrsbindir}/cmirrord}
432 %{_mandir}/man5/lvm.conf.5*
433 %{?with_clvmd:%{_mandir}/man8/clvmd.8*}
434 %{?with_openais:%{_mandir}/man8/cmirrord.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}
447 %{?with_openais:%attr(754,root,root) /etc/rc.d/init.d/cmirrord}
449 %files -n device-mapper
450 %defattr(644,root,root,755)
452 %{systemdunitdir}/dm-event.service
453 %{systemdunitdir}/dm-event.socket
454 /lib/udev/rules.d/10-dm.rules
455 /lib/udev/rules.d/11-dm-lvm.rules
456 /lib/udev/rules.d/13-dm-disk.rules
457 /lib/udev/rules.d/95-dm-notify.rules
458 %attr(755,root,root) %{_sbindir}/dmeventd
459 %attr(755,root,root) %{_sbindir}/dmsetup
460 %attr(755,root,root) /%{_lib}/libdevmapper*.so.*.*
461 %attr(755,root,root) /%{_lib}/liblvm2app.so.*.*
462 %attr(755,root,root) /%{_lib}/liblvm2cmd.so.*.*
463 %dir %{_libdir}/device-mapper
464 %attr(755,root,root) %{_libdir}/device-mapper/*.so
465 %attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
466 %{_mandir}/man8/dmsetup.8*
467 %{_mandir}/man8/dmeventd.8*
469 %files -n device-mapper-devel
470 %defattr(644,root,root,755)
471 %attr(755,root,root) %{_libdir}/libdevmapper.so
472 %attr(755,root,root) %{_libdir}/libdevmapper-event.so
473 %attr(755,root,root) %{_libdir}/liblvm2app.so
474 %attr(755,root,root) %{_libdir}/liblvm2cmd.so
475 %{_includedir}/libdevmapper*.h
476 %{_includedir}/lvm2app.h
477 %{_includedir}/lvm2cmd.h
478 %{_pkgconfigdir}/devmapper*.pc
479 %{_pkgconfigdir}/lvm2app.pc
481 %files -n device-mapper-static
482 %defattr(644,root,root,755)
483 %{_libdir}/libdevmapper*.a
487 %files -n device-mapper-dietlibc
488 %defattr(644,root,root,755)
489 %{dietlibdir}/libdevmapper.a
492 %files -n device-mapper-initrd
493 %defattr(644,root,root,755)
494 %attr(755,root,root) %{_libdir}/initrd/dmsetup
497 %defattr(644,root,root,755)
498 %attr(755,root,root) %{_libdir}/initrd/lvm