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