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