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