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