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_without cman # disable cman cluster support (clvmd)
13 %bcond_without corosync # disable corosync cluster support (clvmd&cmirrord)
14 %bcond_without openais # disable openais cluster support (clvmd)
15 %bcond_with lvmetad # enable lvmetad
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}
37 %if %{without cman} && %{without corosync} && %{without openais}
38 %undefine with_cluster
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}-tmpfiles.conf
51 Patch0: %{name}-selinux.patch
52 Patch1: %{name}-diet.patch
53 Patch2: device-mapper-dmsetup-export.patch
54 Patch3: %{name}-clvmd_init.patch
55 Patch4: dl-dlsym.patch
56 Patch5: pldize_lvm2_monitor.patch
57 Patch6: %{name}-wrapper.patch
58 Patch7: udev-deprecated.patch
59 URL: http://sources.redhat.com/lvm2/
60 BuildRequires: autoconf >= 2.61
61 BuildRequires: automake
62 %{?with_selinux:BuildRequires: libselinux-devel >= 1.10}
63 %{?with_selinux:BuildRequires: libsepol-devel}
64 BuildRequires: ncurses-devel
65 BuildRequires: pkgconfig
66 BuildRequires: readline-devel
67 BuildRequires: rpmbuild(macros) >= 1.647
68 BuildRequires: udev-devel >= 143
71 BuildRequires: dietlibc-static >= 2:0.32-7
72 BuildConflicts: device-mapper-dietlibc
75 %{?with_selinux:BuildRequires: libselinux-static}
76 %{?with_selinux:BuildRequires: libsepol-static}
78 %{?with_glibc:BuildRequires: glibc-static}
79 %{?with_uClibc:BuildRequires: uClibc-static >= 2:0.9.29}
82 %{?with_cman:BuildRequires: cluster-cman-devel}
83 BuildRequires: cluster-dlm-devel
84 %if %{with corosync} || %{with openais}
85 BuildRequires: corosync-devel
87 %{?with_openais:BuildRequires: openais-devel >= 1.0}
89 Requires(post,preun,postun): systemd-units >= 38
90 Requires: device-mapper >= %{version}-%{release}
91 %{?with_selinux:Requires: libselinux >= 1.10}
92 Requires: systemd-units >= 38
93 # doesn't work with 2.4 kernels
94 Requires: uname(release) >= 2.6
96 Obsoletes: lvm2-systemd
97 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
99 %define _sbindir /sbin
100 %define _usrsbindir /usr/sbin
102 # changing CFLAGS in the middle confuses confcache
103 %undefine configure_cache
106 %define filterout_ld -Wl,--as-needed
108 # for some reason known only to rpm there must be "\\|" not "\|" here
109 %define dietarch %(echo %{_target_cpu} | sed -e 's/i.86\\|pentium.\\|athlon/i386/;s/amd64/x86_64/;s/armv.*/arm/')
110 %define dietlibdir %{_prefix}/lib/dietlibc/lib-%{dietarch}
112 %define skip_post_check_so '.*libdevmapper-event-lvm2.so.*'
115 This package includes a number of utilities for creating, checking,
116 and repairing logical volumes.
118 %description -l pl.UTF-8
119 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
120 logicznych wolumenów dyskowych (LVM2).
123 Summary: The new version of Logical Volume Manager for Linux - initrd version
124 Summary(pl.UTF-8): Nowa wersja Logical Volume Managera dla Linuksa - wersja dla initrd
126 Conflicts: geninitrd < 10000.18
129 This package includes a number of utilities for creating, checking,
130 and repairing logical volumes - staticaly linked for initrd.
132 %description initrd -l pl.UTF-8
133 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
134 logicznych wolumenów dyskowych (LVM2) - statycznie skonsolidowane na
138 Summary: Cluster LVM daemon
139 Summary(pl.UTF-8): Demon clustra LVM
140 Group: Applications/System
143 clvmd is the daemon that distributes LVM metadata updates around
144 a cluster. It must be running on all nodes in the cluster and will
145 give an error if a node in the cluster does not have this daemon
148 %description clvmd -l pl.UTF-8
149 clvmd to demon który rozprowadza zmiany meta-danych LVM po klastrze.
150 Mysi działać na wszystkich węzłach klastra i zgłosi błąd gdy
151 jakiś węzeł w klastrze nie ma tego demona uruchomionego.
154 Summary: Cluster mirror log daemon
155 Group: Applications/System
156 Requires: cluster-cman
158 %description cmirrord
159 cmirrord is the daemon that tracks mirror log information in a cluster.
160 It is specific to device-mapper based mirrors (and by extension, LVM cluster
161 mirrors). Cluster mirrors are not possible without this daemon running.
163 This daemon relies on the cluster infrastructure provided by the Cluster
164 MANager (CMAN), which must be set up and running in order for cmirrord to
167 %package -n device-mapper
168 Summary: Userspace support for the device-mapper
169 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika
171 Requires(post,preun,postun): systemd-units >= 38
172 Requires: systemd-units >= 38
174 %description -n device-mapper
175 The goal of this driver is to support volume management. The driver
176 enables the definition of new block devices composed of ranges of
177 sectors of existing devices. This can be used to define disk
178 partitions - or logical volumes. This light-weight kernel component
179 can support user-space tools for logical volume management.
181 %description -n device-mapper -l pl.UTF-8
182 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
183 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
184 sektorów na istniejących urządzeniach. Może to być wykorzystane do
185 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
186 składnik jądra może wspierać działające w przestrzeni użytkownika
187 narzędzia do zarządzania logicznymi wolumenami.
189 %package -n device-mapper-devel
190 Summary: Header files and development documentation for %{name}
191 Summary(pl.UTF-8): Pliki nagłówkowe i dokumentacja do %{name}
192 Group: Development/Libraries
193 Requires: device-mapper = %{version}-%{release}
195 Requires: libselinux-devel
196 Requires: libsepol-devel
199 %description -n device-mapper-devel
200 Header files and development documentation for %{name}.
202 %description -n device-mapper-devel -l pl.UTF-8
203 Pliki nagłówkowe i dokumentacja do %{name}.
205 %package -n device-mapper-static
206 Summary: Static devmapper library
207 Summary(pl.UTF-8): Statyczna biblioteka devmapper
209 Group: Development/Libraries
210 Requires: device-mapper-devel = %{version}-%{release}
212 %description -n device-mapper-static
213 Static devmapper library.
215 %description -n device-mapper-static -l pl.UTF-8
216 Statyczna biblioteka devmapper.
218 %package -n device-mapper-dietlibc
219 Summary: Static devmapper library built with dietlibc
220 Summary(pl.UTF-8): Statyczna biblioteka devmapper zbudowana z dietlibc
222 Group: Development/Libraries
223 Requires: device-mapper-devel = %{version}-%{release}
225 %description -n device-mapper-dietlibc
226 Static devmapper library built with dietlibc.
228 %description -n device-mapper-dietlibc -l pl.UTF-8
229 Statyczna biblioteka devmapper zbudowana z dietlibc.
231 %package -n device-mapper-initrd
232 Summary: Userspace support for the device-mapper - initrd version
233 Summary(pl.UTF-8): Wsparcie dla mapowania urządzeń w przestrzeni użytkownika - wersja dla initrd
235 Obsoletes: device-mapper-initrd-devel
236 Conflicts: geninitrd < 10000.10
238 %description -n device-mapper-initrd
239 The goal of this driver is to support volume management. The driver
240 enables the definition of new block devices composed of ranges of
241 sectors of existing devices. This can be used to define disk
242 partitions - or logical volumes. This light-weight kernel component
243 can support user-space tools for logical volume management.
245 This package contains dmsetup program linked staticaly for use in
248 %description -n device-mapper-initrd -l pl.UTF-8
249 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
250 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
251 sektorów na istniejących urządzeniach. Może to być wykorzystane do
252 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
253 składnik jądra może wspierać działające w przestrzeni użytkownika
254 narzędzia do zarządzania logicznymi wolumenami.
256 Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
260 %setup -q -n LVM2.%{version}
261 %{?with_selinux:%patch0 -p1}
270 # do not force --export-symbol linker option for e.g. statically linked executables
271 # -rdynamic compiler option drives linker in the right way.
272 %{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
276 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
278 cp -f /usr/share/automake/config.sub autoconf
283 %{?with_glibc:export CC="%{__cc}"}
284 %{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
285 %{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
288 ac_cv_lib_dl_dlopen=no \
289 %{?with_uClibc:ac_cv_func_siginterrupt=no} \
290 %{?debug:--enable-debug} \
291 --with-optimisation="%{rpmcflags} -Os" \
292 --enable-static_link \
293 --with-lvm1=internal \
295 --%{?with_glibc:en}%{!?with_glibc:dis}able-selinux \
298 # glibc version links with normal static libdevicemapper which has selinux enabled
299 # and we need to keep these in sync between device-mapper and lvm2
301 %{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
302 %{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
304 %{__make} -j1 -C include
305 %{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
306 %{__make} -j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=
307 %{__make} -j1 -C tools dmsetup.static lvm.static %{?with_dietlibc:DIETLIBC_LIBS="-lcompat"}
308 mv -f tools/lvm.static initrd-lvm
309 mv -f tools/dmsetup.static initrd-dmsetup
311 # check if tools works
312 for tool in initrd-lvm initrd-dmsetup; do
313 LVM_SYSTEM_DIR=$(pwd) ./$tool help && rc=$? || rc=$?
314 if [ $rc -gt 127 ]; then
315 echo >&2 "Unexpected failure (exit status: $rc) from $tool. Does this tool work?!"
321 %{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
328 --with-usrlibdir=%{_libdir} \
329 %{?debug:--enable-debug} \
330 --with-optimisation="%{rpmcflags}" \
335 %{?with_lvmetad:--enable-lvmetad} \
337 --with-dmeventd-path=%{_sbindir}/dmeventd \
340 --enable-udev_rules \
342 %{?with_corosync:--enable-cmirrord} \
343 --with-clvmd=%{?with_cman:cman,}%{?with_openais:openais,}%{?with_corosync:corosync} \
345 --with-lvm1=internal \
346 --with-pool=internal \
347 --with-cluster=internal \
348 --with-snapshots=internal \
349 --with-mirrors=internal \
350 --with-thin=internal \
351 --with-interface=ioctl \
352 --with-udev-prefix=/ \
353 --with-systemd_dir=%{systemdunitdir} \
354 %{!?with_selinux:--disable-selinux}
357 %{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
360 rm -rf $RPM_BUILD_ROOT
361 install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm}
362 %{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
364 %{__make} install install_system_dirs install_systemd_units install_initscripts \
365 DESTDIR=$RPM_BUILD_ROOT \
369 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
370 install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
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
400 %systemd_preun lvm2-monitor.service
403 if [ "$1" = "0" ]; then
404 %service lvm2-monitor stop
405 /sbin/chkconfig --del lvm2-monitor
409 %triggerpostun -- %{name} < 2.02.94-1
410 %systemd_trigger lvm2-monitor.service
412 %post -n device-mapper
414 %systemd_post dm-event.socket
416 %preun -n device-mapper
417 %systemd_preun dm-event.socket dm-event.service
419 %postun -n device-mapper
423 %triggerpostun -n device-mapper -- device-mapper < 2.02.94-1
424 %systemd_trigger dm-event.socket
427 %defattr(644,root,root,755)
428 %doc README WHATS_NEW doc/*
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/fsadm.8*
435 %{_mandir}/man8/lv*.8*
436 %{_mandir}/man8/pv*.8*
437 %{_mandir}/man8/vg*.8*
438 %attr(750,root,root) %dir %{_sysconfdir}/lvm
439 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
440 %{_sysconfdir}/tmpfiles.d/lvm2.conf
441 %{systemdunitdir}/lvm2-monitor.service
442 %dir %{_sysconfdir}/lvm/cache
443 %ghost %{_sysconfdir}/lvm/cache/.cache
444 %attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
448 %defattr(644,root,root,755)
449 %attr(755,root,root) %{_usrsbindir}/clvmd
450 %attr(754,root,root) /etc/rc.d/init.d/clvmd
451 %{_mandir}/man8/clvmd.8*
455 %defattr(644,root,root,755)
456 %attr(755,root,root) %{_usrsbindir}/cmirrord
457 %{_mandir}/man8/cmirrord.8*
458 %attr(754,root,root) /etc/rc.d/init.d/cmirrord
462 %files -n device-mapper
463 %defattr(644,root,root,755)
465 %{systemdunitdir}/dm-event.service
466 %{systemdunitdir}/dm-event.socket
467 /lib/udev/rules.d/10-dm.rules
468 /lib/udev/rules.d/11-dm-lvm.rules
469 /lib/udev/rules.d/13-dm-disk.rules
470 /lib/udev/rules.d/95-dm-notify.rules
471 %attr(755,root,root) %{_sbindir}/dmeventd
472 %attr(755,root,root) %{_sbindir}/dmsetup
473 %attr(755,root,root) /%{_lib}/libdevmapper*.so.*.*
474 %attr(755,root,root) /%{_lib}/liblvm2app.so.*.*
475 %attr(755,root,root) /%{_lib}/liblvm2cmd.so.*.*
476 %dir %{_libdir}/device-mapper
477 %attr(755,root,root) %{_libdir}/device-mapper/*.so
478 %attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
479 %{_mandir}/man8/dmsetup.8*
480 %{_mandir}/man8/dmeventd.8*
482 %files -n device-mapper-devel
483 %defattr(644,root,root,755)
484 %attr(755,root,root) %{_libdir}/libdevmapper.so
485 %attr(755,root,root) %{_libdir}/libdevmapper-event.so
486 %attr(755,root,root) %{_libdir}/liblvm2app.so
487 %attr(755,root,root) %{_libdir}/liblvm2cmd.so
488 %{_includedir}/libdevmapper*.h
489 %{_includedir}/lvm2app.h
490 %{_includedir}/lvm2cmd.h
491 %{_pkgconfigdir}/devmapper*.pc
492 %{_pkgconfigdir}/lvm2app.pc
494 %files -n device-mapper-static
495 %defattr(644,root,root,755)
496 %{_libdir}/libdevmapper*.a
500 %files -n device-mapper-dietlibc
501 %defattr(644,root,root,755)
502 %{dietlibdir}/libdevmapper.a
505 %files -n device-mapper-initrd
506 %defattr(644,root,root,755)
507 %attr(755,root,root) %{_libdir}/initrd/dmsetup
510 %defattr(644,root,root,755)
511 %attr(755,root,root) %{_libdir}/initrd/lvm