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