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