]> git.pld-linux.org Git - packages/lvm2.git/blob - lvm2.spec
51cfa321b01cd4e61190238802df488bd2157242
[packages/lvm2.git] / lvm2.spec
1 # TODO
2 # - vgscan --ignorelocking failure creates /var/lock/lvm (even if /var is not yet mounted)
3 # - --with-replicators (=internal/shared/none, default is none)?
4 # - OCF agents?
5 #
6 # Conditional build:
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
14
15 %ifarch sparc64 sparc
16 %define         with_glibc 1
17 %endif
18
19 # if one of the *libc is enabled disable default dietlibc
20 %if %{with dietlibc} && %{with uClibc}
21 %undefine       with_dietlibc
22 %endif
23
24 # with glibc disables default dietlibc
25 %if %{with glibc} && %{with dietlibc}
26 %undefine       with_dietlibc
27 %endif
28
29 # fallback is glibc if neither alternatives are enabled
30 %if %{without dietlibc} && %{without uClibc}
31 %define         with_glibc      1
32 %endif
33
34 Summary:        The new version of Logical Volume Manager for Linux
35 Summary(pl.UTF-8):      Nowa wersja Logical Volume Managera dla Linuksa
36 Name:           lvm2
37 Version:        2.02.98
38 Release:        1
39 License:        GPL v2
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
63 %if %{with initrd}
64 %if %{with dietlibc}
65 BuildRequires:  dietlibc-static >= 2:0.32-7
66 BuildConflicts: device-mapper-dietlibc
67 %endif
68 %if %{with glibc}
69 %{?with_selinux:BuildRequires:  libselinux-static}
70 %{?with_selinux:BuildRequires:  libsepol-static}
71 %endif
72 %{?with_glibc:BuildRequires:    glibc-static}
73 %{?with_uClibc:BuildRequires:   uClibc-static >= 2:0.9.29}
74 %endif
75 %if %{with cluster}
76 BuildRequires:  corosync-devel
77 BuildRequires:  dlm-devel >= 3.99.5
78 %endif
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
85 Obsoletes:      lvm
86 Obsoletes:      lvm2-systemd
87 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
88
89 %define         _sbindir        /sbin
90 %define         _usrsbindir     /usr/sbin
91
92 # changing CFLAGS in the middle confuses confcache
93 %undefine       configure_cache
94
95 # borken on AC
96 %define         filterout_ld    -Wl,--as-needed
97
98 # causes: undefined reference to `__stack_chk_fail_local'
99 %define         filterout_c     -fstack-protector
100
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}
104
105 %define         skip_post_check_so      '.*libdevmapper-event-lvm2.so.*'
106
107 %description
108 This package includes a number of utilities for creating, checking,
109 and repairing logical volumes.
110
111 %description -l pl.UTF-8
112 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
113 logicznych wolumenów dyskowych (LVM2).
114
115 %package initrd
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
118 Group:          Base
119 Conflicts:      geninitrd < 10000.18
120
121 %description initrd
122 This package includes a number of utilities for creating, checking,
123 and repairing logical volumes - staticaly linked for initrd.
124
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
128 potrzeby initrd.
129
130 %package clvmd
131 Summary:        Cluster LVM daemon
132 Summary(pl.UTF-8):      Demon clustra LVM
133 Group:          Applications/System
134 Requires:       %{name} = %{version}-%{release}
135
136 %description clvmd
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.
140
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.
145
146 %package cmirrord
147 Summary:        Cluster mirror log daemon
148 Group:          Applications/System
149 Requires:       %{name} = %{version}-%{release}
150
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.
156
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.
160
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
164 Group:          Base
165 Requires(post,preun,postun):    systemd-units >= 38
166 Requires:       systemd-units >= 38
167
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.
174
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.
182
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}
188 %if %{with selinux}
189 Requires:       libselinux-devel
190 Requires:       libsepol-devel
191 %endif
192
193 %description -n device-mapper-devel
194 Header files and development documentation for %{name}.
195
196 %description -n device-mapper-devel -l pl.UTF-8
197 Pliki nagłówkowe i dokumentacja do %{name}.
198
199 %package -n device-mapper-static
200 Summary:        Static devmapper library
201 Summary(pl.UTF-8):      Statyczna biblioteka devmapper
202 License:        LGPL v2.1
203 Group:          Development/Libraries
204 Requires:       device-mapper-devel = %{version}-%{release}
205
206 %description -n device-mapper-static
207 Static devmapper library.
208
209 %description -n device-mapper-static -l pl.UTF-8
210 Statyczna biblioteka devmapper.
211
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
215 License:        LGPL v2.1
216 Group:          Development/Libraries
217 Requires:       device-mapper-devel = %{version}-%{release}
218
219 %description -n device-mapper-dietlibc
220 Static devmapper library built with dietlibc.
221
222 %description -n device-mapper-dietlibc -l pl.UTF-8
223 Statyczna biblioteka devmapper zbudowana z dietlibc.
224
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
228 Group:          Base
229 Obsoletes:      device-mapper-initrd-devel
230 Conflicts:      geninitrd < 10000.10
231
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.
238
239 This package contains dmsetup program linked staticaly for use in
240 initrd.
241
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.
249
250 Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
251 potrzeby initrd.
252
253 %prep
254 %setup -q -n LVM2.%{version}
255 %{?with_selinux:%patch0 -p1}
256 %patch1 -p1
257 %patch2 -p1
258 %patch3 -p1
259 %patch4 -p1
260 %patch5 -p1
261 %patch6 -p1
262
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
266
267 %build
268 %if %{with initrd}
269 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
270 %endif
271 cp -f /usr/share/automake/config.sub autoconf
272 %{__aclocal}
273 %{__autoconf}
274
275 %if %{with initrd}
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 }"}
279
280 %configure \
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 \
287         --disable-selinux \
288         --%{?with_glibc:en}%{!?with_glibc:dis}able-selinux \
289         --disable-readline \
290         --disable-nls
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
293
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
296
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
304
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?!"
310                 exit 1
311         fi
312 done
313
314
315 %{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
316 %{__make} clean
317
318 unset CC
319 %endif
320
321 %configure \
322         --with-usrlibdir=%{_libdir} \
323         %{?debug:--enable-debug} \
324         --with-optimisation="%{rpmcflags}" \
325         --enable-readline \
326         --enable-fsadm \
327         --enable-applib \
328         --enable-cmdlib \
329         %{?with_lvmetad:--enable-lvmetad} \
330         --enable-dmeventd \
331         --with-dmeventd-path=%{_sbindir}/dmeventd \
332         --enable-pkgconfig \
333         --enable-udev_sync \
334         --enable-udev_rules \
335 %if %{with cluster}
336         --with-clvmd=corosync \
337         --enable-cmirrord \
338 %endif
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}
350
351 %{__make} -j1
352 %{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
353
354 %install
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}}
358
359 %{__make} install install_system_dirs install_systemd_units install_initscripts \
360         DESTDIR=$RPM_BUILD_ROOT \
361         OWNER="" \
362         GROUP=""
363
364 install -d $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
365 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
366
367 %if %{with cluster}
368 install %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/clvmd.service
369 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/clvmd
370 %endif
371
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
377 done
378
379 touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
380
381 %if %{with initrd}
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
385
386 %{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
387 %endif
388
389 cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
390
391 %clean
392 rm -rf $RPM_BUILD_ROOT
393
394 %post
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
401
402 %preun
403 %systemd_preun lvm2-monitor.service
404 %systemd_preun blk-availability.service
405
406 %postun
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
412 fi
413 %systemd_reload
414
415 %triggerpostun -- %{name} < 2.02.94-1
416 %systemd_trigger lvm2-monitor.service
417
418 %post -n device-mapper
419 /sbin/ldconfig
420 %systemd_post dm-event.socket
421
422 %preun -n device-mapper
423 %systemd_preun dm-event.socket dm-event.service
424
425 %postun -n device-mapper
426 /sbin/ldconfig
427 %systemd_reload
428
429 %triggerpostun -n device-mapper -- device-mapper < 2.02.94-1
430 %systemd_trigger dm-event.socket
431
432 %post clvmd
433 /sbin/chkconfig --add clvmd
434 # no service restart - it breaks current locks!
435 export NORESTART=1
436 %systemd_post clvmd.service
437 # re-exec instead
438 /usr/sbin/clvmd -S 2>/dev/null || :
439
440 %preun clvmd
441 %systemd_preun clvmd.service
442
443 %postun clvmd
444 if [ "$1" = "0" ]; then
445         %service clvmd stop
446         /sbin/chkconfig --del clvmd
447 fi
448 %systemd_reload
449
450 %files
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
474
475 %if %{with cluster}
476 %files clvmd
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*
483
484 %files cmirrord
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
489 %endif
490
491 %files -n device-mapper
492 %defattr(644,root,root,755)
493 %doc *_DM
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*
510
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
522
523 %files -n device-mapper-static
524 %defattr(644,root,root,755)
525 %{_libdir}/libdevmapper*.a
526
527 %if %{with initrd}
528 %if %{with dietlibc}
529 %files -n device-mapper-dietlibc
530 %defattr(644,root,root,755)
531 %{dietlibdir}/libdevmapper.a
532 %endif
533
534 %files -n device-mapper-initrd
535 %defattr(644,root,root,755)
536 %attr(755,root,root) %{_libdir}/initrd/dmsetup
537
538 %files initrd
539 %defattr(644,root,root,755)
540 %attr(755,root,root) %{_libdir}/initrd/lvm
541 %endif
This page took 0.105295 seconds and 2 git commands to generate.