Whamcloud - gitweb
LU-6245 libcfs: cleanup libcfs lock handling
[fs/lustre-release.git] / lustre.spec.in
1 # lustre.spec
2
3 # Declare rpmbuild --with/--without parameters
4 %bcond_without servers
5 %bcond_without ldiskfs
6 %bcond_with zfs
7 %bcond_without lustre_tests
8 %bcond_without lustre_utils
9 %bcond_without lustre_iokit
10 %bcond_without lustre_modules
11 %bcond_with lnet_dlc
12
13 %if %{without servers}
14     # --without servers overrides --with {ldiskfs|zfs}
15     # so undefine the internal variables set by bcond_*
16     %undefine with_ldiskfs
17     %undefine with_zfs
18 %endif
19
20 %{!?version: %global version @VERSION@}
21 %{!?kver:    %global kver    %(uname -r)}
22 %{!?kdir:    %global kdir    /lib/modules/%{kver}/source}
23 %{!?kobjdir: %global kobjdir %(if [ "%{kdir}" = "/lib/modules/%{kver}/source" ]; then echo "/lib/modules/%{kver}/build"; else echo "%{kdir}"; fi)}
24
25 # as an alternative to this implementation we could simply "make -C $kdir kernelversion"
26 %{!?kversion: %global kversion %(files="include/generated/utsrelease.h include/linux/utsrelease.h include/linux/version.h"; for f in $files; do if test -r %{kobjdir}/$f && grep UTS_RELEASE %{kobjdir}/$f >/dev/null; then sed -ne '/^#define UTS_RELEASE/s/.*"\\(.*\\)"$/\\1/p' %{kobjdir}/$f; break; fi; done)}
27
28 %define buildid %(if [ -n "@BUILDID@" ]; then echo "_@BUILDID@"; fi)
29
30 %if 0%{?build_src_rpm}
31     %{!?myrelease: %global myrelease 1}
32 %else
33     %{!?downstream_release: %global downstream_release "@DOWNSTREAM_RELEASE@"}
34     %{!?myrelease: %global myrelease %(if [ -n "%downstream_release" ]; then echo -n "%{downstream_release}_"; fi; echo %kversion | tr '-' '_')}
35 %endif
36
37 # always append the buildid, even when the caller defines %release
38 %define fullrelease %{myrelease}%{buildid}
39
40 # in order to get kernel symset and/or kernel module dependencies into
41 # the RPM, in order to support weak-modules, the internal dependency gen-
42 # erator needs to be disabled
43 # this is done with (reduce the double % down to a single %):
44 #
45 # %%global _use_internal_dependency_generator 0
46 #
47 # on SLES10, /usr/lib/rpm/macros already sets this, so no harm in also
48 # defining it here (until Suse changes their mind)
49 #
50 # on RHEL5, however, we do need to explicitly disable the internal dep-
51 # endency generator and allow the external one be used
52 # but since RedHat's kABI is only a subset of the total kernel ABI, it
53 # doesn't include all of the symbols we (or OFED for that matter) need
54 # until RedHat includes all of the symbols we need in their symsets we
55 # cannot support weak-modules
56 # we did e-mail the maintainer of all of this stuff @redhat but got no
57 # response from them
58 #%%global _use_internal_dependency_generator 0
59
60 # for those uses that don't want the -smp/-bigsmp (or the .arch) on the end
61 # of %kversion
62 %define krequires %(echo %{kversion} | sed -e 's/\.x86_64$//' -e 's/\.i[3456]86$//' -e 's/-smp$//' -e 's/-bigsmp$//' -e 's/-ppc64$//' -e 's/-default$//')
63
64 # Set the package name prefix
65 %if %{undefined lustre_name}
66     %if %{with servers}
67         %global lustre_name lustre
68     %else
69         %global lustre_name lustre-client
70     %endif
71 %endif
72
73 %if %{undefined kmoddir}
74     %if %{defined kernel_module_package_moddir}
75         %global kmoddir %{kernel_module_package_moddir}
76     %else
77         %if %{defined suse_kernel_module_package}
78             %global kmoddir updates
79         %else
80             %global kmoddir extra
81         %endif
82     %endif
83 %endif
84
85 %if %{defined cross_path} && %{defined post_script}
86 %define rpm_post_base %(dirname %{cross_path})/%{lustre_name}
87 %endif
88
89 # SUSE don't support .debug_info section from cross compiler:
90 # /usr/lib/rpm/debugedit: Unhandled relocation 10 in .debug_info section
91 %if %{defined cross_path} && 0%{?suse_version}
92 %global __debug_install_post %{nil}
93 %global __debug_package %{nil}
94 %global debug_package %{nil}
95 %endif
96
97 Summary: Lustre File System
98 Name: %{lustre_name}
99 Version: %{version}
100 Release: %{fullrelease}
101 License: GPL
102 Group: Utilities/System
103 Source: lustre-%{version}.tar.gz
104 URL: https://wiki.hpdd.intel.com/
105 BuildRoot: %{_tmppath}/lustre-%{version}-root
106 Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap nfs-utils-lustre
107 Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}
108 Requires: %{name}-modules = %{version}
109 BuildRequires: libtool python-docutils
110 %if %{with servers}
111 Requires: lustre-osd
112 Requires: lustre-osd-mount
113 %endif
114 %if %{defined cross_requires}
115 Requires: %{cross_requires}
116 AutoReqProv: no
117 %else
118 # GSS requires this: BuildRequires: pkgconfig, libgssapi-devel >= 0.10
119 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
120 #suse don't support selinux
121 BuildRequires: libselinux-devel
122 Requires: libselinux
123 %endif
124 %endif
125
126 %description
127 Userspace tools and files for the Lustre file system.
128
129 %if %{with lustre_modules}
130 %package modules
131 Summary: Kernel Lustre modules for Linux %{kversion}
132 %if %{defined cross_requires}
133 Requires: %{cross_requires}
134 AutoReqProv: no
135 %else
136 # for SLES11, we need nothing here
137 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
138 # for RHEL we need to require the specific kernel still since weak-modules
139 # support on RH is, well, weak, to be punny about it
140 Requires: kernel = %{krequires}
141 %if %{with lnet_dlc}
142 Requires: libyaml
143 BuildRequires: libyaml-devel
144 %endif
145 %endif
146 %endif
147 Group: Development/Kernel
148
149 %description modules
150 Lustre file system, server and network drivers for Linux %{kversion}.
151
152 %if %{with ldiskfs}
153 %package osd-ldiskfs
154 Summary: osd-ldiskfs contains both ldiskfs and its osd interface in Lustre.
155 Requires: lustre-modules = %{version}
156 Requires: module-init-tools >= 3.9
157 Requires: ldiskfsprogs >= 1.42.7.wc1
158 Requires: lustre-osd-ldiskfs-mount
159 Provides: lustre-osd
160 Obsoletes: lustre-ldiskfs
161 Group: Development/Kernel
162
163 %description osd-ldiskfs
164 The Lustre Object Storage Device (OSD) API is the interface to access and
165 modify data that is supposed to be stored persistently. This API is the interface
166 to code that bridges individual file systems. This specific package provides an
167 implementation of the OSD API for using the Ldiskfs filesystem as the underlying
168 backing store of a Lustre server.
169
170 %if %{with lustre_utils}
171 %package osd-ldiskfs-mount
172 Summary: osd-ldiskfs-mount contains mount's ldiskfs specific dso.
173 Provides: lustre-osd-mount
174 Group: Development/Kernel
175
176 %description osd-ldiskfs-mount
177 LDISKFS hooks for mount/mkfs into a dynamic library.
178
179 %endif
180 %endif
181
182 %if %{with zfs}
183 %package osd-zfs
184 Summary: osd-zfs is the mandatory glue for ZFS support in Lustre.
185 Requires: lustre-modules = %{version}, zfs-kmod
186 Requires: lustre-osd-zfs-mount
187 Provides: lustre-osd
188 Group: Development/Kernel
189
190 %description osd-zfs
191 The Lustre Object Storage Device (OSD) API is the interface to access and
192 modify data that is supposed to be stored persistently. This API is the interface
193 to code that bridges individual file systems. This specific package provides an
194 implementation of the OSD API for using the ZFS filesystem as the underlying
195 backing store of a Lustre server.
196
197 %if %{with lustre_utils}
198 %package osd-zfs-mount
199 Summary: osd-zfs-mount contains mount's ldiskfs specific dso.
200 Provides: lustre-osd-mount
201 Group: Development/Kernel
202
203 %description osd-zfs-mount
204 ZFS hooks for mount/mkfs into a dynamic library.
205
206 %endif
207 %endif
208 %endif # with lustre_modules
209
210 %package source
211 Summary: Object-Based Disk storage driver source
212 Group: Development/Kernel
213
214 %description source
215 Lustre sources for further development
216
217 # Since the RPMs we ship are to be used on both SLES and RHEL, we
218 # can't include any dependency information (since the package names
219 # are different on the two platforms).
220 #
221 # Instead, we can build these empty meta-packages that only include
222 # dependency information.  These let people get the correct
223 # dependencies for their platform and lets them use tools like yum and
224 # red carpet to install the correct files.
225 #
226 # Unfortunately I have not seen this come up on the lists much, so I
227 # have disabled them (by commenting out their empty files section
228 # below) until it's clear that they resolve more confusion than they
229 # add.
230
231 %package deps-sles
232 Summary: Lustre dependencies meta-package for SLES
233 Group: Utilities/System
234 Provides: lustre-deps = %{version}
235 Requires: %{name} = %{version}, sles-release
236 Conflicts: %{name}-deps-rhel
237
238 %description deps-sles
239 This package has RPM dependencies appropriate for SLES systems.
240
241 %package deps-rhel
242 Summary: Lustre dependencies meta-package for RHEL
243 Group: Utilities/System
244 Provides: lustre-deps = %{version}
245 Requires: %{name} = %{version}, redhat-release
246 Conflicts: %{name}-deps-sles
247
248 %description deps-rhel
249 This package has RPM dependencies appropriate for RHEL, RHL, and FC
250 systems.
251
252 %package tests
253 Summary: Lustre testing framework
254 Group: Development/Kernel
255 Provides: %{name}-tests = %{version}
256 Requires: %{name} = %{version}, %{name}-modules = %{version}, lustre-iokit
257 Requires: attr, rsync, perl, lsof, /usr/bin/getconf
258
259 %description tests
260 This package contains a set of test binaries and scripts that are intended
261 to be used by the Lustre testing framework.
262
263 %if %{with lustre_iokit}
264 %package -n lustre-iokit
265 Summary: The Lustre IO-Kit is a collection of benchmark tools for a cluster with the Lustre file system.
266 Group: Applications/System
267 Requires: python > 2.2, sg3_utils
268
269 %description -n lustre-iokit
270 This package includes five tools:
271 sgpdd-survey:
272 A test of the 'bare metal' performance, bypassing as much of the kernel as we can. Uses the sgp_dd utility.
273
274 obdfilter-survey
275 This survey can be run in 3 modes to test disk I/O including the filesystem,
276 network I/O, and disk I/O via the network.  The script does sequential I/O
277 with varying numbers of threads and objects (files) by using lctl::test_brw
278 to drive the echo_client connected to local or remote obdfilter instances,
279 or remote obdecho instances.
280
281 ost-survey
282 This survey tests the client-to-disk performance of individual OSTs, and
283 ranks then for comparison.
284
285 stats-collect
286 This script will collect IO stats on a defined set of nodes.
287
288 ior-survey:
289 A script to run the IOR benchmark. The latest version can be downloaded from
290 http://www.llnl.gov/asci/purple/benchmarks/limited/ior/
291
292 mds-survey:
293 This survey tests the local metadata performance using the echo_client to drive
294 the MDD layer to perform operations. It is run with multiple threads (to
295 simulate MDT service threads) locally on the MDS node, and does not need Lustre
296 clients in order to run
297 %endif
298
299 %if 0%{?suse_version}
300 %debug_package
301 %endif
302 %prep
303 %setup -qn lustre-%{version}
304 ln lustre/ChangeLog ChangeLog-lustre
305 ln lnet/ChangeLog ChangeLog-lnet
306
307 %build
308
309 # Set an explicit path to our Linux tree, if we can.
310 cd $RPM_BUILD_DIR/lustre-%{version}
311 # override %optflags so that the vendor's overzealous flags don't create
312 # build failures
313 %define optflags -g -O2 -Werror
314
315 CONFIGURE_ARGS="%{?configure_args}"
316 if [ -n "$CONFIGURE_ARGS" ]; then
317         # make sure %%kdir and %%kobjdir are not in the configure arguments
318         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux=[^ ][^ ]* \?//')
319         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux-obj=[^ ][^ ]* \?//')
320         # remove --with-kmp-moddir from configure arguments,
321         # it will be set --with-kmp-moddir=%%kmoddir
322         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-kmp-moddir=[^ ][^ ]* \?//')
323 fi
324
325 # we need to eval "configure" because $CONFIGURE_ARGS could have a quoted
326 # string in it which we don't want word splitted by the shell
327 # also remove (build|host|target) options because they will be specified
328 # inside $CONFIGURE_ARGS
329 %define eval_configure %(echo '%configure' | sed -e 's#\./configure#eval ./configure#' -e 's/--\\(build\\|host\\|target\\)=[^ ][^ ]* //g')
330
331 %eval_configure $CONFIGURE_ARGS \
332         %{?with_lustre_tests:--enable-tests}%{!?with_lustre_tests:--disable-tests} \
333         %{?with_lustre_utils:--enable-utils}%{!?with_lustre_utils:--disable-utils} \
334         %{?with_lustre_modules:--enable-modules}%{!?with_lustre_modules:--disable-modules} \
335         %{!?with_lustre_iokit:--disable-iokit} \
336         %{!?with_ldiskfs:--disable-ldiskfs} \
337         %{!?with_servers:--disable-server} \
338         %{!?with_zfs:--without-zfs} \
339         %{!?with_lnet_dlc:--disable-dlc} \
340         --with-release=%{release} \
341         --with-linux=%{kdir} \
342         --with-linux-obj=%{kobjdir} \
343         --with-kmp-moddir=%{kmoddir}
344
345 make %{?_smp_mflags} -s %{?make_args}
346
347 %install
348 make install DESTDIR=$RPM_BUILD_ROOT
349
350 :> lustre.files
351
352 %if %{with servers} && %{with lustre_utils}
353 # The .ha_v2 extension identifies the heartbeat resource agent as using
354 # legacy syntax. Install a compatibility symlink to avoid conflicts when
355 # newer-style agents are added.
356 ln -s Lustre.ha_v2 $RPM_BUILD_ROOT%{_sysconfdir}/ha.d/resource.d/Lustre
357 echo '%{_sysconfdir}/ha.d/resource.d/Lustre.ha_v2' >>lustre.files
358 echo '%{_sysconfdir}/ha.d/resource.d/Lustre' >>lustre.files
359 %endif
360
361 %if %{_vendor}=="redhat"
362 # The following scripts are Red Hat specific
363 %if %{with servers}
364 echo '%{_sysconfdir}/sysconfig/lustre' >>lustre.files
365 echo '%{_sysconfdir}/init.d/lustre' >>lustre.files
366 %endif
367 echo '%{_sysconfdir}/init.d/lnet' >>lustre.files
368 %endif
369
370 # Create the pristine source directory.
371 cd $RPM_BUILD_DIR/lustre-%{version}
372 mkdir -p $RPM_BUILD_ROOT%{_prefix}/src
373 rm -f lustre-source
374 ln -s $RPM_BUILD_ROOT%{_prefix}/src lustre-source
375 make distdir distdir=lustre-source/lustre-%{version}
376 chmod -R go-w lustre-source/lustre-%{version}
377 # fc18 needs 'x' permission for library files
378 find $RPM_BUILD_ROOT -name \*.so -type f -exec chmod +x {} \;
379
380 %if %{with lnet_dlc}
381 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.a' >>lustre.files
382 echo '%attr(-, root, root) %{_libdir}/liblnetconfig.so' >>lustre.files
383 %endif
384
385 %if %{with ldiskfs}
386 echo '%{_libdir}/libiam.a' >>lustre.files
387 %endif
388
389 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
390         echo '%{_libdir}/lustre/snmp' >>lustre.files
391         echo '%{_datadir}/lustre/snmp/mibs' >>lustre.files
392 fi
393
394 find $RPM_BUILD_ROOT%{_libdir}/@PACKAGE@ \
395     -name \*.la -type f -exec rm -f {} \;
396
397 %if %{with lustre_tests}
398 echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
399 echo '%{_bindir}/mcreate' >>lustre-tests.files
400 echo '%{_bindir}/munlink' >>lustre-tests.files
401 echo '%{_bindir}/req_layout' >>lustre-tests.files
402 echo '%{_sbindir}/wirecheck' >>lustre-tests.files
403 echo '%{_sbindir}/wiretest' >>lustre-tests.files
404 %if %{with lustre_modules}
405 echo '%{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko' >>lustre-tests.files
406 %endif
407 %endif
408
409 %if %{defined cross_path}
410 %if %{defined rpm_post_base}
411 POST_SCRIPT=$RPM_BUILD_DIR/lustre-%{version}/%{post_script}
412 if [ -f $POST_SCRIPT ]; then
413         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}.sh
414         echo '%attr(0555, root, root) %{rpm_post_base}.sh' >>lustre.files
415         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-modules.sh
416 %if %{with ldiskfs}
417         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-osd-ldiskfs.sh
418 %if %{with lustre_utils}
419         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-mount-osd-ldiskfs.sh
420 %endif
421 %endif
422 %if %{with zfs}
423         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-osd-zfs.sh
424 %if %{with lustre_utils}
425         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-mount-osd-zfs.sh
426 %endif
427 %endif
428 %if %{with lustre_tests}
429         cp -f $POST_SCRIPT $RPM_BUILD_ROOT/%{rpm_post_base}-tests.sh
430         echo '%attr(0555, root, root) %{rpm_post_base}-tests.sh' >>lustre-tests.files
431 %endif
432 fi
433 %endif
434 %else
435 %if %{with lustre_modules}
436 # mark modules executable for find-debuginfo.sh
437 find $RPM_BUILD_ROOT%{?rootdir}/lib/modules/%{kversion}/%{kmoddir} \
438     -name \*.ko -type f -exec chmod u+x {} \;
439 %endif
440 %endif
441
442 %files -f lustre.files
443 %defattr(-,root,root)
444 %{_sbindir}/*
445 %if %{with zfs}
446 %exclude %{_sbindir}/zfsobj2fid
447 %endif
448 %if %{with lustre_utils}
449 %if %{with servers}
450 %{_libexecdir}/lustre/lc_common
451 %{_libexecdir}/lustre/haconfig
452 %{_bindir}/lustre_req_history
453 %endif
454
455 %{_bindir}/llobdstat
456 %{_bindir}/llstat
457 %{_bindir}/plot-llstat
458
459 %{_bindir}/lfs
460 %{_bindir}/lfs_migrate
461 %{?rootdir}/sbin/mount.lustre
462 %{_libdir}/libptlctl.a
463 %{_libdir}/libcfsutil.a
464 %{_libdir}/liblustreapi.a
465 %{_libdir}/liblustreapi.so
466 %{_mandir}/man?/*
467 %{_includedir}/lustre
468 %{_includedir}/libcfs
469 %endif
470 %{_datadir}/lustre
471 %{_sysconfdir}/udev/rules.d/99-lustre.rules
472 %config(noreplace) %{_sysconfdir}/ldev.conf
473
474 %if %{with lustre_modules}
475 %files modules
476 %defattr(-,root,root)
477 %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/*
478 %if %{with lustre_tests}
479 %exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko
480 %endif
481 %if %{with ldiskfs}
482 %exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko
483 %exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_ldiskfs.ko
484 %endif
485 %if %{with zfs}
486 %exclude %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_zfs.ko
487 %endif
488 %if %{defined rpm_post_base}
489 %attr(0555, root, root) %{rpm_post_base}-modules.sh
490 %endif
491 %doc COPYING
492 %doc ChangeLog-lustre
493 %doc ChangeLog-lnet
494
495 %if %{with ldiskfs}
496 %files osd-ldiskfs
497 %defattr(-,root,root)
498 %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko
499 %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_ldiskfs.ko
500 %if %{defined rpm_post_base}
501 %attr(0555, root, root) %{rpm_post_base}-osd-ldiskfs.sh
502 %endif
503 %if %{with lustre_utils}
504 %files osd-ldiskfs-mount
505 %defattr(-,root,root)
506 %{_libdir}/@PACKAGE@/mount_osd_ldiskfs.so
507 %if %{defined rpm_post_base}
508 %attr(0555, root, root) %{rpm_post_base}-mount-osd-ldiskfs.sh
509 %endif
510 %endif
511 %endif
512
513 %if %{with zfs}
514 %files osd-zfs
515 %defattr(-,root,root)
516 %{?rootdir}/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_zfs.ko
517 %{_sbindir}/zfsobj2fid
518 %if %{defined rpm_post_base}
519 %attr(0555, root, root) %{rpm_post_base}-osd-zfs.sh
520 %endif
521 %if %{with lustre_utils}
522 %files osd-zfs-mount
523 %defattr(-,root,root)
524 %{_libdir}/@PACKAGE@/mount_osd_zfs.so
525 %if %{defined rpm_post_base}
526 %attr(0555, root, root) %{rpm_post_base}-mount-osd-zfs.sh
527 %endif
528 %endif
529 %endif
530 %endif # with lustre_modules
531
532 %files source
533 %defattr(-,root,root)
534 %{_prefix}/src/lustre-%{version}
535
536 # uncomment these lines to enable deps packages
537 # %files deps-sles
538 # %files deps-rhel
539
540 %if %{with lustre_tests}
541 %files tests -f lustre-tests.files
542 %defattr(-,root,root)
543 %endif
544
545 %if %{with lustre_iokit}
546 %files -n lustre-iokit
547 %defattr(-, root, root)
548 %{_bindir}/iokit-config
549 %{_bindir}/iokit-gather-stats
550 %{_bindir}/iokit-libecho
551 %{_bindir}/iokit-lstats
552 %{_bindir}/iokit-parse-ior
553 %{_bindir}/iokit-plot-obdfilter
554 %{_bindir}/iokit-plot-ost
555 %{_bindir}/iokit-plot-sgpdd
556 %{_bindir}/ior-survey
557 %{_bindir}/mds-survey
558 %{_bindir}/obdfilter-survey
559 %{_bindir}/ost-survey
560 %{_bindir}/sgpdd-survey
561 %doc lustre-iokit/ior-survey/README.ior-survey
562 %doc lustre-iokit/mds-survey/README.mds-survey
563 %doc lustre-iokit/obdfilter-survey/README.obdfilter-survey
564 %doc lustre-iokit/ost-survey/README.ost-survey
565 %doc lustre-iokit/sgpdd-survey/README.sgpdd-survey
566 %doc lustre-iokit/stats-collect/README.iokit-lstats
567 %endif
568
569 %if %{defined rpm_post_base}
570 %post
571 if [ -x %{rpm_post_base}.sh ]; then
572         %{rpm_post_base}.sh %{cross_path} create
573 fi
574
575 %preun
576 if [ -x %{rpm_post_base}.sh ]; then
577         %{rpm_post_base}.sh %{cross_path} remove
578 fi
579 %endif
580
581 %if %{with lustre_modules}
582 %post modules
583 %if %{defined rpm_post_base}
584 if [ -x %{rpm_post_base}-modules.sh ]; then
585         %{rpm_post_base}-modules.sh %{cross_path} create
586 fi
587 %else
588 if [ -f /boot/System.map-%{kversion} ]; then
589         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
590 else
591         depmod -ae %{kversion} || exit 0
592 fi
593
594 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
595 # "weak modules" support
596 # Suse
597 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
598     rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
599         /usr/lib/module-init-tools/weak-modules --add-modules
600 fi
601 # RedHat
602 if [ -x /sbin/weak-modules ]; then
603     rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
604         /sbin/weak-modules --add-modules
605 fi
606
607 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
608 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
609 # print a warning so that users are aware of this issue.
610 if sysctl kernel.unsupported >/dev/null 2>&1 &&
611    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
612     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
613      echo "
614      warning: the Lustre modules are not supported by Novell. To use Lustre
615               on this system, you should put
616
617      allow_unsupported_modules 1
618
619      into /etc/modprobe.d/unsupported_modules"
620 fi
621 %endif
622
623 %if %{with ldiskfs}
624 %post osd-ldiskfs
625 %if %{defined rpm_post_base}
626 if [ -x %{rpm_post_base}-osd-ldiskfs.sh ]; then
627         %{rpm_post_base}-osd-ldiskfs.sh %{cross_path} create
628 fi
629 %else
630 if [ -f /boot/System.map-%{kversion} ]; then
631        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
632 else
633        depmod -ae %{kversion} || exit 0
634 fi
635
636 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
637 # "weak modules" support
638 # Suse
639 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
640     rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
641         /usr/lib/module-init-tools/weak-modules --add-modules
642 fi
643 # RedHat
644 if [ -x /sbin/weak-modules ]; then
645     rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
646         /sbin/weak-modules --add-modules
647 fi
648
649 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
650 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
651 # print a warning so that users are aware of this issue.
652 if sysctl kernel.unsupported >/dev/null 2>&1 &&
653    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
654     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
655      echo "
656      warning: the Lustre modules are not supported by Novell. To use Lustre
657               on this system, you should put
658
659      allow_unsupported_modules 1
660
661      into /etc/modprobe.d/unsupported_modules"
662 fi
663 %endif
664 %if %{with lustre_utils} && %{defined rpm_post_base}
665 %post osd-ldiskfs-mount
666 if [ -x %{rpm_post_base}-mount-osd-ldiskfs.sh ]; then
667         %{rpm_post_base}-mount-osd-ldiskfs.sh %{cross_path} create
668 fi
669 %endif
670 %endif
671
672 %if %{with zfs}
673 %post osd-zfs
674 %if %{defined rpm_post_base}
675 if [ -x %{rpm_post_base}-osd-zfs.sh ]; then
676         %{rpm_post_base}-osd-zfs.sh %{cross_path} create
677 fi
678 %else
679 if [ -f /boot/System.map-%{kversion} ]; then
680        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
681 else
682        depmod -ae %{kversion} || exit 0
683 fi
684
685 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
686 # "weak modules" support
687 # Suse
688 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
689     rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
690         /usr/lib/module-init-tools/weak-modules --add-modules
691 fi
692 # RedHat
693 if [ -x /sbin/weak-modules ]; then
694     rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
695         /sbin/weak-modules --add-modules
696 fi
697
698 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
699 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
700 # print a warning so that users are aware of this issue.
701 if sysctl kernel.unsupported >/dev/null 2>&1 &&
702    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
703     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
704      echo "
705      warning: the Lustre modules are not supported by Novell. To use Lustre
706               on this system, you should put
707
708      allow_unsupported_modules 1
709
710      into /etc/modprobe.d/unsupported_modules"
711 fi
712 %endif
713 %if %{with lustre_utils} && %{defined rpm_post_base}
714 %post osd-zfs-mount
715 if [ -x %{rpm_post_base}-mount-osd-zfs.sh ]; then
716         %{rpm_post_base}-mount-osd-zfs.sh %{cross_path} create
717 fi
718 %endif
719 %endif
720
721 %preun modules
722 %if %{defined rpm_post_base}
723 if [ -x %{rpm_post_base}-modules.sh ]; then
724         %{rpm_post_base}-modules.sh %{cross_path} remove
725 fi
726 %else
727 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
728 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' > /var/run/%{name}-modules || true
729 %endif
730
731 %if %{with ldiskfs}
732 %preun osd-ldiskfs
733 %if %{defined rpm_post_base}
734 if [ -x %{rpm_post_base}-osd-ldiskfs.sh ]; then
735         %{rpm_post_base}-osd-ldiskfs.sh %{cross_path} remove
736 fi
737 %else
738 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
739 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-ldiskfs || true
740 %endif
741 %if %{with lustre_utils} && %{defined rpm_post_base}
742 %preun osd-ldiskfs-mount
743 if [ -x %{rpm_post_base}-mount-osd-ldiskfs.sh ]; then
744         %{rpm_post_base}-mount-osd-ldiskfs.sh %{cross_path} remove
745 fi
746 %endif
747 %endif
748
749 %if %{with zfs}
750 %preun osd-zfs
751 %if %{defined rpm_post_base}
752 if [ -x %{rpm_post_base}-osd-zfs.sh ]; then
753         %{rpm_post_base}-osd-zfs.sh %{cross_path} remove
754 fi
755 %else
756 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
757 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-zfs || true
758 %endif
759 %if %{with lustre_utils} && %{defined rpm_post_base}
760 %preun osd-zfs-mount
761 if [ -x %{rpm_post_base}-mount-osd-zfs.sh ]; then
762         %{rpm_post_base}-mount-osd-zfs.sh %{cross_path} remove
763 fi
764 %endif
765 %endif
766
767 %if %{undefined cross_path}
768 %postun modules
769 if [ -f /boot/System.map-%{kversion} ]; then
770         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
771 else
772         depmod -ae %{kversion} || exit 0
773 fi
774
775 # "weak modules" support
776 # Suse
777 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
778     cat /var/run/%{name}-modules |
779         /usr/lib/module-init-tools/weak-modules --remove-modules
780 fi
781 # RedHat
782 if [ -x /sbin/weak-modules ]; then
783     cat /var/run/%{name}-modules |
784         /sbin/weak-modules --remove-modules
785 fi
786 rm /var/run/%{name}-modules
787
788 %if %{with ldiskfs}
789 %postun osd-ldiskfs
790 if [ -f /boot/System.map-%{kversion} ]; then
791        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
792 else
793        depmod -ae %{kversion} || exit 0
794 fi
795
796 # "weak modules" support
797 # Suse
798 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
799     cat /var/run/%{name}-osd-ldiskfs |
800         /usr/lib/module-init-tools/weak-modules --remove-modules
801 fi
802 # RedHat
803 if [ -x /sbin/weak-modules ]; then
804     cat /var/run/%{name}-osd-ldiskfs |
805         /sbin/weak-modules --remove-modules
806 fi
807 rm /var/run/%{name}-osd-ldiskfs
808 %endif
809
810 %if %{with zfs}
811 %postun osd-zfs
812 if [ -f /boot/System.map-%{kversion} ]; then
813        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
814 else
815        depmod -ae %{kversion} || exit 0
816 fi
817
818 # "weak modules" support
819 # Suse
820 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
821     cat /var/run/%{name}-osd-zfs |
822         /usr/lib/module-init-tools/weak-modules --remove-modules
823 fi
824 # RedHat
825 if [ -x /sbin/weak-modules ]; then
826     cat /var/run/%{name}-osd-zfs |
827         /sbin/weak-modules --remove-modules
828 fi
829 rm /var/run/%{name}-osd-zfs
830 %endif
831 %endif
832 %endif # with lustre_modules
833
834 %if %{with lustre_tests}
835 %if %{defined rpm_post_base}
836 %post tests
837 if [ -x %{rpm_post_base}-tests.sh ]; then
838         %{rpm_post_base}-tests.sh %{cross_path} create
839 fi
840
841 %preun tests
842 if [ -x %{rpm_post_base}-tests.sh ]; then
843         %{rpm_post_base}-tests.sh %{cross_path} remove
844 fi
845 %else
846 %if %{with lustre_modules}
847 %post tests
848 if [ -f /boot/System.map-%{kversion} ]; then
849         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
850 else
851         depmod -ae %{kversion} || exit 0
852 fi
853
854 %postun tests
855 if [ -f /boot/System.map-%{kversion} ]; then
856         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
857 else
858         depmod -ae %{kversion} || exit 0
859 fi
860 %endif
861 %endif
862 %endif
863
864 %clean
865 rm -rf $RPM_BUILD_ROOT