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