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