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