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