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