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