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