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