]> TLD Linux GIT Repositories - packages/lvm2.git/blob - lvm2.spec
- from PLD
[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:        3
39 License:        GPL v2 and LGPL v2.1
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 Patch7:         %{name}-sd_notify.patch
54 Patch8:         %{name}-clvmd_cmd_timeout.patch
55 Patch9:         device-mapper-dmsetup-deps-export.patch
56 URL:            http://sources.redhat.com/lvm2/
57 BuildRequires:  autoconf >= 2.61
58 BuildRequires:  automake
59 %{?with_selinux:BuildRequires:  libselinux-devel >= 1.10}
60 %{?with_selinux:BuildRequires:  libsepol-devel}
61 BuildRequires:  ncurses-devel
62 BuildRequires:  pkgconfig
63 BuildRequires:  readline-devel
64 BuildRequires:  rpmbuild(macros) >= 1.647
65 BuildRequires:  udev-devel >= 143
66 %if %{with initrd}
67 %if %{with dietlibc}
68 BuildRequires:  dietlibc-static >= 2:0.32-7
69 BuildConflicts: device-mapper-dietlibc
70 %endif
71 %if %{with glibc}
72 %{?with_selinux:BuildRequires:  libselinux-static}
73 %{?with_selinux:BuildRequires:  libsepol-static}
74 %endif
75 %{?with_glibc:BuildRequires:    glibc-static}
76 %{?with_uClibc:BuildRequires:   uClibc-static >= 2:0.9.29}
77 %endif
78 %if %{with cluster}
79 BuildRequires:  corosync-devel
80 BuildRequires:  dlm-devel >= 3.99.5
81 BuildRequires:  systemd-devel
82 %endif
83 Requires(post,preun,postun):    systemd-units >= 38
84 Requires(post,postun):  /sbin/chkconfig
85 Requires:       device-mapper >= %{version}-%{release}
86 %{?with_selinux:Requires:       libselinux >= 1.10}
87 Requires:       systemd-units >= 38
88 # doesn't work with 2.4 kernels
89 Requires:       uname(release) >= 2.6
90 Obsoletes:      lvm
91 Obsoletes:      lvm2-systemd
92 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
93
94 %define         _sbindir        /sbin
95 %define         _usrsbindir     /usr/sbin
96
97 # changing CFLAGS in the middle confuses confcache
98 %undefine       configure_cache
99
100 # borken on AC
101 %define         filterout_ld    -Wl,--as-needed
102
103 # causes: undefined reference to `__stack_chk_fail_local'
104 %define         filterout_c     -fstack-protector
105
106 # for some reason known only to rpm there must be "\\|" not "\|" here
107 %define         dietarch        %(echo %{_target_cpu} | sed -e 's/i.86\\|pentium.\\|athlon/i386/;s/amd64/x86_64/;s/armv.*/arm/')
108 %define         dietlibdir      %{_prefix}/lib/dietlibc/lib-%{dietarch}
109
110 %define         skip_post_check_so      '.*libdevmapper-event-lvm2.so.*'
111
112 %description
113 This package includes a number of utilities for creating, checking,
114 and repairing logical volumes.
115
116 %description -l pl.UTF-8
117 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
118 logicznych wolumenów dyskowych (LVM2).
119
120 %package initrd
121 Summary:        The new version of Logical Volume Manager for Linux - initrd version
122 Summary(pl.UTF-8):      Nowa wersja Logical Volume Managera dla Linuksa - wersja dla initrd
123 Group:          Base
124 Conflicts:      geninitrd < 10000.18
125
126 %description initrd
127 This package includes a number of utilities for creating, checking,
128 and repairing logical volumes - staticaly linked for initrd.
129
130 %description initrd -l pl.UTF-8
131 Pakiet ten zawiera narzędzia do tworzenia, sprawdzania i naprawiania
132 logicznych wolumenów dyskowych (LVM2) - statycznie skonsolidowane na
133 potrzeby initrd.
134
135 %package clvmd
136 Summary:        Cluster LVM daemon
137 Summary(pl.UTF-8):      Demon clustra LVM
138 Group:          Applications/System
139 Requires:       %{name} = %{version}-%{release}
140
141 %description clvmd
142 clvmd is the daemon that distributes LVM metadata updates around a
143 cluster. It must be running on all nodes in the cluster and will give
144 an error if a node in the cluster does not have this daemon running.
145
146 %description clvmd -l pl.UTF-8
147 clvmd to demon który rozprowadza zmiany meta-danych LVM po klastrze.
148 Mysi działać na wszystkich węzłach klastra i zgłosi błąd gdy jakiś
149 węzeł w klastrze nie ma tego demona uruchomionego.
150
151 %package cmirrord
152 Summary:        Cluster mirror log daemon
153 Group:          Applications/System
154 Requires:       %{name} = %{version}-%{release}
155
156 %description cmirrord
157 cmirrord is the daemon that tracks mirror log information in a
158 cluster. It is specific to device-mapper based mirrors (and by
159 extension, LVM cluster mirrors). Cluster mirrors are not possible
160 without this daemon running.
161
162 This daemon relies on the cluster infrastructure provided by the
163 Cluster MANager (CMAN), which must be set up and running in order for
164 cmirrord to function.
165
166 %package -n device-mapper
167 Summary:        Userspace support for the device-mapper
168 Summary(pl.UTF-8):      Wsparcie dla mapowania urządzeń w przestrzeni użytkownika
169 Group:          Base
170 Requires(post,preun,postun):    systemd-units >= 38
171 Requires:       systemd-units >= 38
172
173 %description -n device-mapper
174 The goal of this driver is to support volume management. The driver
175 enables the definition of new block devices composed of ranges of
176 sectors of existing devices. This can be used to define disk
177 partitions - or logical volumes. This light-weight kernel component
178 can support user-space tools for logical volume management.
179
180 %description -n device-mapper -l pl.UTF-8
181 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
182 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
183 sektorów na istniejących urządzeniach. Może to być wykorzystane do
184 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
185 składnik jądra może wspierać działające w przestrzeni użytkownika
186 narzędzia do zarządzania logicznymi wolumenami.
187
188 %package -n device-mapper-devel
189 Summary:        Header files and development documentation for %{name}
190 Summary(pl.UTF-8):      Pliki nagłówkowe i dokumentacja do %{name}
191 Group:          Development/Libraries
192 Requires:       device-mapper = %{version}-%{release}
193 %if %{with selinux}
194 Requires:       libselinux-devel
195 Requires:       libsepol-devel
196 %endif
197
198 %description -n device-mapper-devel
199 Header files and development documentation for %{name}.
200
201 %description -n device-mapper-devel -l pl.UTF-8
202 Pliki nagłówkowe i dokumentacja do %{name}.
203
204 %package -n device-mapper-static
205 Summary:        Static devmapper library
206 Summary(pl.UTF-8):      Statyczna biblioteka devmapper
207 License:        LGPL v2.1
208 Group:          Development/Libraries
209 Requires:       device-mapper-devel = %{version}-%{release}
210
211 %description -n device-mapper-static
212 Static devmapper library.
213
214 %description -n device-mapper-static -l pl.UTF-8
215 Statyczna biblioteka devmapper.
216
217 %package -n device-mapper-dietlibc
218 Summary:        Static devmapper library built with dietlibc
219 Summary(pl.UTF-8):      Statyczna biblioteka devmapper zbudowana z dietlibc
220 License:        LGPL v2.1
221 Group:          Development/Libraries
222 Requires:       device-mapper-devel = %{version}-%{release}
223
224 %description -n device-mapper-dietlibc
225 Static devmapper library built with dietlibc.
226
227 %description -n device-mapper-dietlibc -l pl.UTF-8
228 Statyczna biblioteka devmapper zbudowana z dietlibc.
229
230 %package -n device-mapper-initrd
231 Summary:        Userspace support for the device-mapper - initrd version
232 Summary(pl.UTF-8):      Wsparcie dla mapowania urządzeń w przestrzeni użytkownika - wersja dla initrd
233 Group:          Base
234 Obsoletes:      device-mapper-initrd-devel
235 Conflicts:      geninitrd < 10000.10
236
237 %description -n device-mapper-initrd
238 The goal of this driver is to support volume management. The driver
239 enables the definition of new block devices composed of ranges of
240 sectors of existing devices. This can be used to define disk
241 partitions - or logical volumes. This light-weight kernel component
242 can support user-space tools for logical volume management.
243
244 This package contains dmsetup program linked staticaly for use in
245 initrd.
246
247 %description -n device-mapper-initrd -l pl.UTF-8
248 Celem tego sterownika jest obsługa zarządzania wolumenami. Sterownik
249 włącza definiowanie nowych urządzeń blokowych złożonych z przedziałów
250 sektorów na istniejących urządzeniach. Może to być wykorzystane do
251 definiowania partycji na dysku lub logicznych wolumenów. Ten lekki
252 składnik jądra może wspierać działające w przestrzeni użytkownika
253 narzędzia do zarządzania logicznymi wolumenami.
254
255 Ten pakiet zawiera program dmsetup skonsolidowany statycznie na
256 potrzeby initrd.
257
258 %prep
259 %setup -q -n LVM2.%{version}
260 %{?with_selinux:%patch0 -p1}
261 %patch1 -p1
262 %patch2 -p1
263 %patch3 -p1
264 %patch4 -p1
265 %patch5 -p1
266 %patch6 -p1
267 %patch7 -p1
268 %patch8 -p1
269 %patch9 -p1
270
271 # do not force --export-symbol linker option for e.g. statically linked executables
272 # -rdynamic compiler option drives linker in the right way.
273 %{__sed} -i -e 's#-Wl,--export-dynamic#-rdynamic#g' configure.in
274
275 %build
276 %if %{with initrd}
277 echo Using %{?with_glibc:GLIBC} %{?with_uClibc:uClibc} %{?with_dietlibc:diet} for initrd
278 %endif
279 cp -f /usr/share/automake/config.sub autoconf
280 %{__aclocal}
281 %{__autoconf}
282
283 %if %{with initrd}
284 %{?with_glibc:export CC="%{__cc}"}
285 %{?with_uClibc:export CC="%{_target_cpu}-uclibc-gcc"}
286 %{?with_dietlibc:cc="%{__cc}"; export CC="diet ${cc#ccache }"}
287
288 %configure \
289         ac_cv_lib_dl_dlopen=no \
290         %{?with_uClibc:ac_cv_func_siginterrupt=no} \
291         %{?debug:--enable-debug} \
292         --with-optimisation="%{rpmcflags} -Os" \
293         --enable-static_link \
294         --with-lvm1=internal \
295         --disable-selinux \
296         --%{?with_glibc:en}%{!?with_glibc:dis}able-selinux \
297         --disable-readline \
298         --disable-nls
299 # glibc version links with normal static libdevicemapper which has selinux enabled
300 # and we need to keep these in sync between device-mapper and lvm2
301
302 %{__sed} -i -e 's#rpl_malloc#malloc#g' lib/misc/configure.h
303 %{__sed} -i -e 's#rpl_realloc#realloc#g' lib/misc/configure.h
304
305 %{__make} -j1 -C include
306 %{__make} -j1 -C lib LIB_SHARED= VERSIONED_SHLIB=
307 %{__make} -j1 -C libdm LIB_SHARED= VERSIONED_SHLIB=
308 %{__make} -j1 -C libdaemon/client LIB_SHARED= VERSIONED_SHLIB=
309 %{__make} -j1 -C tools dmsetup.static lvm.static %{?with_dietlibc:DIETLIBC_LIBS="-lcompat"}
310 mv -f tools/lvm.static initrd-lvm
311 mv -f tools/dmsetup.static initrd-dmsetup
312
313 # check if tools works
314 for tool in initrd-lvm initrd-dmsetup; do
315         LVM_SYSTEM_DIR=$(pwd) ./$tool help && rc=$? || rc=$?
316         if [ $rc -gt 127 ]; then
317                 echo >&2 "Unexpected failure (exit status: $rc) from $tool. Does this tool work?!"
318                 exit 1
319         fi
320 done
321
322
323 %{?with_dietlibc:mv -f libdm/ioctl/libdevmapper.a diet-libdevmapper.a}
324 %{__make} clean
325
326 unset CC
327 %endif
328
329 %configure \
330         --with-usrlibdir=%{_libdir} \
331         %{?debug:--enable-debug} \
332         --with-optimisation="%{rpmcflags}" \
333         --enable-readline \
334         --enable-fsadm \
335         --enable-applib \
336         --enable-cmdlib \
337         %{?with_lvmetad:--enable-lvmetad} \
338         --enable-dmeventd \
339         --with-dmeventd-path=%{_sbindir}/dmeventd \
340         --enable-pkgconfig \
341         --enable-udev_sync \
342         --enable-udev_rules \
343 %if %{with cluster}
344         --with-clvmd=corosync \
345         --enable-cmirrord \
346 %endif
347         --with-lvm1=internal \
348         --with-pool=internal \
349         --with-cluster=internal \
350         --with-snapshots=internal \
351         --with-mirrors=internal \
352         --with-thin=internal \
353         --with-thin-check="" \
354         --with-interface=ioctl \
355         --with-udev-prefix=/ \
356         --with-systemd_dir=%{systemdunitdir} \
357         %{!?with_selinux:--disable-selinux}
358
359 %{__make} -j1
360 %{__make} -j1 -C libdm LIB_STATIC=libdevmapper.a
361
362 %install
363 rm -rf $RPM_BUILD_ROOT
364 install -d $RPM_BUILD_ROOT{/%{_lib},%{_sysconfdir}/lvm,/etc/sysconfig}
365 %{?with_dietlibc:install -d $RPM_BUILD_ROOT%{dietlibdir}}
366
367 %{__make} install install_system_dirs install_systemd_units install_initscripts \
368         DESTDIR=$RPM_BUILD_ROOT \
369         OWNER="" \
370         GROUP=""
371
372 install -d $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
373 install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
374
375 %if %{with cluster}
376 install %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/clvmd.service
377 install %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/clvmd
378 %endif
379
380 mv $RPM_BUILD_ROOT%{_libdir}/lib*.so.* $RPM_BUILD_ROOT/%{_lib}
381 for lib in $RPM_BUILD_ROOT/%{_lib}/lib*.so.*; do
382         lib=$(echo $lib | sed -e "s#$RPM_BUILD_ROOT##g")
383         slib=$(basename $lib | sed -e 's#\.so\..*#.so#g')
384         ln -sf $lib $RPM_BUILD_ROOT%{_libdir}/$slib
385 done
386
387 touch $RPM_BUILD_ROOT%{_sysconfdir}/lvm/lvm.conf
388
389 %if %{with initrd}
390 install -d $RPM_BUILD_ROOT%{_libdir}/initrd
391 install -p initrd-lvm $RPM_BUILD_ROOT%{_libdir}/initrd/lvm
392 install -p initrd-dmsetup $RPM_BUILD_ROOT%{_libdir}/initrd/dmsetup
393
394 %{?with_dietlibc:cp -a diet-libdevmapper.a $RPM_BUILD_ROOT%{dietlibdir}/libdevmapper.a}
395 %endif
396
397 cp -a libdm/libdevmapper.a $RPM_BUILD_ROOT%{_libdir}
398
399 %clean
400 rm -rf $RPM_BUILD_ROOT
401
402 %post
403 /sbin/chkconfig --add lvm2-monitor
404 %service lvm2-monitor restart
405 %systemd_post lvm2-monitor.service
406 /sbin/chkconfig --add blk-availability
407 # no service blk-availability restart
408 %systemd_post blk-availability.service
409
410 %preun
411 %systemd_preun lvm2-monitor.service
412 %systemd_preun blk-availability.service
413
414 %postun
415 if [ "$1" = "0" ]; then
416         %service lvm2-monitor stop
417         /sbin/chkconfig --del lvm2-monitor
418         #no service blk-availability stop
419         /sbin/chkconfig --del blk-availability
420 fi
421 %systemd_reload
422
423 %triggerpostun -- %{name} < 2.02.94-1
424 %systemd_trigger lvm2-monitor.service
425
426 %post -n device-mapper
427 /sbin/ldconfig
428 %systemd_post dm-event.socket
429
430 %preun -n device-mapper
431 %systemd_preun dm-event.socket dm-event.service
432
433 %postun -n device-mapper
434 /sbin/ldconfig
435 %systemd_reload
436
437 %triggerpostun -n device-mapper -- device-mapper < 2.02.94-1
438 %systemd_trigger dm-event.socket
439
440 %post clvmd
441 /sbin/chkconfig --add clvmd
442 # no service restart - it breaks current locks!
443 export NORESTART=1
444 %systemd_post clvmd.service
445 # re-exec instead
446 /usr/sbin/clvmd -S 2>/dev/null || :
447
448 %preun clvmd
449 %systemd_preun clvmd.service
450
451 %postun clvmd
452 if [ "$1" = "0" ]; then
453         %service clvmd stop
454         /sbin/chkconfig --del clvmd
455 fi
456 %systemd_reload
457
458 %files
459 %defattr(644,root,root,755)
460 %doc README WHATS_NEW doc/*
461 %attr(755,root,root) %{_sbindir}/blkdeactivate
462 %attr(755,root,root) %{_sbindir}/fsadm
463 %attr(755,root,root) %{_sbindir}/lv*
464 %attr(755,root,root) %{_sbindir}/pv*
465 %attr(755,root,root) %{_sbindir}/vg*
466 %{_mandir}/man5/lvm.conf.5*
467 %{_mandir}/man8/blkdeactivate.8*
468 %{_mandir}/man8/fsadm.8*
469 %{_mandir}/man8/lv*.8*
470 %{_mandir}/man8/pv*.8*
471 %{_mandir}/man8/vg*.8*
472 %attr(750,root,root) %dir %{_sysconfdir}/lvm
473 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
474 %{_sysconfdir}/tmpfiles.d/lvm2.conf
475 %{systemdunitdir}/lvm2-monitor.service
476 %{systemdunitdir}/blk-availability.service
477 %dir %{_sysconfdir}/lvm/cache
478 %ghost %{_sysconfdir}/lvm/cache/.cache
479 %attr(754,root,root) /etc/rc.d/init.d/blk-availability
480 %attr(754,root,root) /etc/rc.d/init.d/lvm2-monitor
481 %dir %attr(700,root,root) /var/run/lvm
482
483 %if %{with cluster}
484 %files clvmd
485 %defattr(644,root,root,755)
486 %attr(755,root,root) %{_usrsbindir}/clvmd
487 %attr(754,root,root) /etc/rc.d/init.d/clvmd
488 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/clvmd
489 %{systemdunitdir}/clvmd.service
490 %{_mandir}/man8/clvmd.8*
491
492 %files cmirrord
493 %defattr(644,root,root,755)
494 %attr(755,root,root) %{_usrsbindir}/cmirrord
495 %{_mandir}/man8/cmirrord.8*
496 %attr(754,root,root) /etc/rc.d/init.d/cmirrord
497 %endif
498
499 %files -n device-mapper
500 %defattr(644,root,root,755)
501 %doc *_DM
502 %{systemdunitdir}/dm-event.service
503 %{systemdunitdir}/dm-event.socket
504 /lib/udev/rules.d/10-dm.rules
505 /lib/udev/rules.d/11-dm-lvm.rules
506 /lib/udev/rules.d/13-dm-disk.rules
507 /lib/udev/rules.d/95-dm-notify.rules
508 %attr(755,root,root) %{_sbindir}/dmeventd
509 %attr(755,root,root) %{_sbindir}/dmsetup
510 %attr(755,root,root) /%{_lib}/libdevmapper*.so.*.*
511 %attr(755,root,root) /%{_lib}/liblvm2app.so.*.*
512 %attr(755,root,root) /%{_lib}/liblvm2cmd.so.*.*
513 %dir %{_libdir}/device-mapper
514 %attr(755,root,root) %{_libdir}/device-mapper/*.so
515 %attr(755,root,root) %{_libdir}/libdevmapper-event-*.so
516 %{_mandir}/man8/dmsetup.8*
517 %{_mandir}/man8/dmeventd.8*
518
519 %files -n device-mapper-devel
520 %defattr(644,root,root,755)
521 %attr(755,root,root) %{_libdir}/libdevmapper.so
522 %attr(755,root,root) %{_libdir}/libdevmapper-event.so
523 %attr(755,root,root) %{_libdir}/liblvm2app.so
524 %attr(755,root,root) %{_libdir}/liblvm2cmd.so
525 %{_includedir}/libdevmapper*.h
526 %{_includedir}/lvm2app.h
527 %{_includedir}/lvm2cmd.h
528 %{_pkgconfigdir}/devmapper*.pc
529 %{_pkgconfigdir}/lvm2app.pc
530
531 %files -n device-mapper-static
532 %defattr(644,root,root,755)
533 %{_libdir}/libdevmapper*.a
534
535 %if %{with initrd}
536 %if %{with dietlibc}
537 %files -n device-mapper-dietlibc
538 %defattr(644,root,root,755)
539 %{dietlibdir}/libdevmapper.a
540 %endif
541
542 %files -n device-mapper-initrd
543 %defattr(644,root,root,755)
544 %attr(755,root,root) %{_libdir}/initrd/dmsetup
545
546 %files initrd
547 %defattr(644,root,root,755)
548 %attr(755,root,root) %{_libdir}/initrd/lvm
549 %endif