Whamcloud - gitweb
bcd2349bc112fe599c91fca9ffe61064d27644ad
[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_modules}
386 # mark modules executable for find-debuginfo.sh
387 find $RPM_BUILD_ROOT/lib/modules -name \*.ko -type f -exec chmod u+x {} \;
388 %endif
389
390 %if %{with lustre_tests}
391 echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
392 echo '%{_bindir}/mcreate' >>lustre-tests.files
393 echo '%{_bindir}/munlink' >>lustre-tests.files
394 echo '%{_bindir}/req_layout' >>lustre-tests.files
395 echo '%{_sbindir}/wirecheck' >>lustre-tests.files
396 echo '%{_sbindir}/wiretest' >>lustre-tests.files
397 %if %{with lustre_modules}
398 echo '/lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko' >>lustre-tests.files
399 %endif
400 %endif
401
402 %files -f lustre.files
403 %defattr(-,root,root)
404 %{_sbindir}/*
405 %exclude %{_sbindir}/wirecheck
406 %exclude %{_sbindir}/wiretest
407 %if %{with zfs}
408 %exclude %{_sbindir}/zfsobj2fid
409 %endif
410 %if %{with lustre_utils}
411 %if %{with servers}
412 %{_libexecdir}/lustre/lc_common
413 %{_libexecdir}/lustre/haconfig
414 %{_bindir}/lustre_req_history
415 %endif
416
417 %{_bindir}/llobdstat
418 %{_bindir}/llstat
419 %{_bindir}/plot-llstat
420
421 %{_bindir}/lfs
422 %{_bindir}/lfs_migrate
423 /sbin/mount.lustre
424 %{_libdir}/libptlctl.a
425 %{_libdir}/libcfsutil.a
426 %{_libdir}/liblustreapi.a
427 %{_libdir}/liblustreapi.so
428 %if %{with manpages}
429 %{_mandir}/man?/*
430 %endif
431 %{_includedir}/lustre
432 %{_includedir}/libcfs
433 %endif
434 %{_datadir}/lustre
435 %{_sysconfdir}/udev/rules.d/99-lustre.rules
436 %config(noreplace) %{_sysconfdir}/ldev.conf
437 %config(noreplace) %{_sysconfdir}/modprobe.d/ko2iblnd.conf
438
439 %if %{with lustre_modules}
440 %files modules
441 %defattr(-,root,root)
442 /lib/modules/%{kversion}/%{kmoddir}/*
443 %if %{with lustre_tests}
444 %exclude /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/llog_test.ko
445 %endif
446 %if %{with ldiskfs}
447 %exclude /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko
448 %exclude /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_ldiskfs.ko
449 %endif
450 %if %{with zfs}
451 %exclude /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_zfs.ko
452 %endif
453 %doc COPYING
454 %doc ChangeLog-lustre
455 %doc ChangeLog-lnet
456
457 %if %{with ldiskfs}
458 %files osd-ldiskfs
459 %defattr(-,root,root)
460 /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/ldiskfs.ko
461 /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_ldiskfs.ko
462 %if %{with lustre_utils}
463 %files osd-ldiskfs-mount
464 %defattr(-,root,root)
465 %{_libdir}/@PACKAGE@/mount_osd_ldiskfs.so
466 %endif
467 %endif
468
469 %if %{with zfs}
470 %files osd-zfs
471 %defattr(-,root,root)
472 /lib/modules/%{kversion}/%{kmoddir}/kernel/fs/@PACKAGE@/osd_zfs.ko
473 %{_sbindir}/zfsobj2fid
474 %if %{with lustre_utils}
475 %files osd-zfs-mount
476 %defattr(-,root,root)
477 %{_libdir}/@PACKAGE@/mount_osd_zfs.so
478 %endif
479 %endif
480 %endif # with lustre_modules
481
482 %files source
483 %defattr(-,root,root)
484 %{_prefix}/src/lustre-%{version}
485
486 # uncomment these lines to enable deps packages
487 # %files deps-sles
488 # %files deps-rhel
489
490 %if %{with lustre_tests}
491 %files tests -f lustre-tests.files
492 %defattr(-,root,root)
493 %endif
494
495 %if %{with lustre_iokit}
496 %files -n lustre-iokit
497 %defattr(-, root, root)
498 %{_bindir}/iokit-config
499 %{_bindir}/iokit-gather-stats
500 %{_bindir}/iokit-libecho
501 %{_bindir}/iokit-lstats
502 %{_bindir}/iokit-parse-ior
503 %{_bindir}/iokit-plot-obdfilter
504 %{_bindir}/iokit-plot-ost
505 %{_bindir}/iokit-plot-sgpdd
506 %{_bindir}/ior-survey
507 %{_bindir}/mds-survey
508 %{_bindir}/obdfilter-survey
509 %{_bindir}/ost-survey
510 %{_bindir}/sgpdd-survey
511 %doc lustre-iokit/ior-survey/README.ior-survey
512 %doc lustre-iokit/mds-survey/README.mds-survey
513 %doc lustre-iokit/obdfilter-survey/README.obdfilter-survey
514 %doc lustre-iokit/ost-survey/README.ost-survey
515 %doc lustre-iokit/sgpdd-survey/README.sgpdd-survey
516 %doc lustre-iokit/stats-collect/README.iokit-lstats
517 %endif
518
519 %if %{with lustre_modules}
520 %post modules
521 if [ -f /boot/System.map-%{kversion} ]; then
522         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
523 else
524         depmod -ae %{kversion} || exit 0
525 fi
526
527 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
528 # "weak modules" support
529 # Suse
530 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
531     rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
532         /usr/lib/module-init-tools/weak-modules --add-modules
533 fi
534 # RedHat
535 if [ -x /sbin/weak-modules ]; then
536     rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
537         /sbin/weak-modules --add-modules
538 fi
539
540 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
541 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
542 # print a warning so that users are aware of this issue.
543 if sysctl kernel.unsupported >/dev/null 2>&1 &&
544    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
545     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
546      echo "
547      warning: the Lustre modules are not supported by Novell. To use Lustre
548               on this system, you should put
549
550      allow_unsupported_modules 1
551
552      into /etc/modprobe.d/unsupported_modules"
553 fi
554
555 %if %{with ldiskfs}
556 %post osd-ldiskfs
557 if [ -f /boot/System.map-%{kversion} ]; then
558        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
559 else
560        depmod -ae %{kversion} || exit 0
561 fi
562
563 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
564 # "weak modules" support
565 # Suse
566 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
567     rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
568         /usr/lib/module-init-tools/weak-modules --add-modules
569 fi
570 # RedHat
571 if [ -x /sbin/weak-modules ]; then
572     rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
573         /sbin/weak-modules --add-modules
574 fi
575
576 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
577 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
578 # print a warning so that users are aware of this issue.
579 if sysctl kernel.unsupported >/dev/null 2>&1 &&
580    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
581     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
582      echo "
583      warning: the Lustre modules are not supported by Novell. To use Lustre
584               on this system, you should put
585
586      allow_unsupported_modules 1
587
588      into /etc/modprobe.d/unsupported_modules"
589 fi
590 %endif
591
592 %if %{with zfs}
593 %post osd-zfs
594 if [ -f /boot/System.map-%{kversion} ]; then
595        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
596 else
597        depmod -ae %{kversion} || exit 0
598 fi
599
600 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
601 # "weak modules" support
602 # Suse
603 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
604     rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
605         /usr/lib/module-init-tools/weak-modules --add-modules
606 fi
607 # RedHat
608 if [ -x /sbin/weak-modules ]; then
609     rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
610         /sbin/weak-modules --add-modules
611 fi
612
613 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
614 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
615 # print a warning so that users are aware of this issue.
616 if sysctl kernel.unsupported >/dev/null 2>&1 &&
617    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
618     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
619      echo "
620      warning: the Lustre modules are not supported by Novell. To use Lustre
621               on this system, you should put
622
623      allow_unsupported_modules 1
624
625      into /etc/modprobe.d/unsupported_modules"
626 fi
627 %endif
628
629 %preun modules
630 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
631 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' > /var/run/%{name}-modules || true
632
633 %if %{with ldiskfs}
634 %preun osd-ldiskfs
635 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
636 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-ldiskfs || true
637 %endif
638
639 %if %{with zfs}
640 %preun osd-zfs
641 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
642 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-zfs || true
643 %endif
644
645 %postun modules
646 if [ -f /boot/System.map-%{kversion} ]; then
647         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
648 else
649         depmod -ae %{kversion} || exit 0
650 fi
651
652 # "weak modules" support
653 # Suse
654 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
655     cat /var/run/%{name}-modules |
656         /usr/lib/module-init-tools/weak-modules --remove-modules
657 fi
658 # RedHat
659 if [ -x /sbin/weak-modules ]; then
660     cat /var/run/%{name}-modules |
661         /sbin/weak-modules --remove-modules
662 fi
663 rm /var/run/%{name}-modules
664
665 %if %{with ldiskfs}
666 %postun osd-ldiskfs
667 if [ -f /boot/System.map-%{kversion} ]; then
668        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
669 else
670        depmod -ae %{kversion} || exit 0
671 fi
672
673 # "weak modules" support
674 # Suse
675 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
676     cat /var/run/%{name}-osd-ldiskfs |
677         /usr/lib/module-init-tools/weak-modules --remove-modules
678 fi
679 # RedHat
680 if [ -x /sbin/weak-modules ]; then
681     cat /var/run/%{name}-osd-ldiskfs |
682         /sbin/weak-modules --remove-modules
683 fi
684 rm /var/run/%{name}-osd-ldiskfs
685 %endif
686
687 %if %{with zfs}
688 %postun osd-zfs
689 if [ -f /boot/System.map-%{kversion} ]; then
690        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
691 else
692        depmod -ae %{kversion} || exit 0
693 fi
694
695 # "weak modules" support
696 # Suse
697 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
698     cat /var/run/%{name}-osd-zfs |
699         /usr/lib/module-init-tools/weak-modules --remove-modules
700 fi
701 # RedHat
702 if [ -x /sbin/weak-modules ]; then
703     cat /var/run/%{name}-osd-zfs |
704         /sbin/weak-modules --remove-modules
705 fi
706 rm /var/run/%{name}-osd-zfs
707 %endif
708 %endif # with lustre_modules
709
710 %if %{with lustre_tests}
711 %if %{with lustre_modules}
712 %post tests
713 if [ -f /boot/System.map-%{kversion} ]; then
714         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
715 else
716         depmod -ae %{kversion} || exit 0
717 fi
718
719 %postun tests
720 if [ -f /boot/System.map-%{kversion} ]; then
721         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
722 else
723         depmod -ae %{kversion} || exit 0
724 fi
725 %endif
726 %endif
727
728 %clean
729 rm -rf $RPM_BUILD_ROOT