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