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