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