Whamcloud - gitweb
Revert "LU-2459 osd: add LMA incompat flag check"
[fs/lustre-release.git] / lustre.spec.in
1 # lustre.spec
2 %{!?version: %global version @VERSION@}
3 %{!?kver: %global kver ""}
4 %{!?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)}
5
6 %{!?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)}
7
8 # as an alternative to this implementation we could simply "make -C $kdir kernelversion"
9 %{!?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)}
10
11 %{!?downstream_release: %global downstream_release "@DOWNSTREAM_RELEASE@"}
12
13 %define buildid %(if [ -n "@BUILDID@" ]; then echo "_@BUILDID@"; fi)
14
15 %{!?myrelease: %global myrelease %(if [ -n "%downstream_release" ]; then echo -n "%{downstream_release}_"; fi; echo %kversion | tr '-' '_')}
16
17 # always append the buildid, even when the caller defines %release
18 %define fullrelease %{myrelease}%{buildid}
19
20 %{!?lustre_name: %global lustre_name lustre}
21 %{!?build_lustre_tests: %global build_lustre_tests 1}
22
23 %{!?build_lustre_osd_ldiskfs: %global build_lustre_osd_ldiskfs 0}
24 %{!?build_lustre_osd_zfs: %global build_lustre_osd_zfs 0}
25
26 # in order to get kernel symset and/or kernel module dependencies into
27 # the RPM, in order to support weak-modules, the internal dependency gen-
28 # erator needs to be disabled
29 # this is done with (reduce the double % down to a single %):
30 #
31 # %%global _use_internal_dependency_generator 0
32 #
33 # on SLES10, /usr/lib/rpm/macros already sets this, so no harm in also
34 # defining it here (until Suse changes their mind)
35 #
36 # on RHEL5, however, we do need to explicitly disable the internal dep-
37 # endency generator and allow the external one be used
38 # but since RedHat's kABI is only a subset of the total kernel ABI, it
39 # doesn't include all of the symbols we (or OFED for that matter) need
40 # until RedHat includes all of the symbols we need in their symsets we
41 # cannot support weak-modules
42 # we did e-mail the maintainer of all of this stuff @redhat but got no
43 # response from them
44 #%%global _use_internal_dependency_generator 0
45
46 %define is_client %(bash -c "if [[ %{lustre_name} = *-client ]]; then echo -n '1'; else echo -n '0'; fi")
47 # for those uses that don't want the -smp/-bigsmp (or the .arch) on the end
48 # of %kversion
49 %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$//'")
50
51 %define sles10 %(bash -c "if [ "%sles_version" = "10" ]; then echo -n '1'; else echo -n '0'; fi")
52
53 %if %sles10
54 %define flavor %(bash -c "echo %{kversion} | sed -e 's/^.*-//'")
55 %endif
56
57 %if %is_client
58 %define build_lustre_osd_ldiskfs 0
59 %define build_lustre_osd_zfs 0
60 %endif
61
62 Summary: Lustre File System
63 Name: %{lustre_name}
64 Version: %{version}
65 Release: %{fullrelease}
66 License: GPL
67 Group: Utilities/System
68 Source: lustre-%{version}.tar.gz
69 URL: http://wiki.whamcloud.com/
70 BuildRoot: %{_tmppath}/lustre-%{version}-root
71 Obsoletes: lustre-lite, lustre-lite-utils, lustre-ldap nfs-utils-lustre
72 Provides: lustre-lite = %{version}, lustre-lite-utils = %{version}
73 Requires: %{name}-modules = %{version}
74 # GSS requires this: BuildRequires: pkgconfig, libgssapi-devel >= 0.10
75
76 %description
77 Userspace tools and files for the Lustre file system.
78
79 %package modules
80 Summary: Kernel Lustre modules for Linux %{kversion}
81 # for SLES11, we need nothing here
82 # for SLES10, we need (where %{flavor} is, i.e. smp):
83 %if %sles10
84 Requires: kernel-%{flavor}
85 %else
86 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
87 # for RHEL we need to require the specific kernel still since weak-modules
88 # support on RH is, well, weak, to be punny about it
89 Requires: kernel = %{krequires}
90 %endif
91 %endif
92 %if ! %{is_client}
93 Requires: lustre-osd
94 %endif
95 Group: Development/Kernel
96
97 %description modules
98 Lustre file system, server and network drivers for Linux %{kversion}.
99
100 %if %{build_lustre_osd_ldiskfs}
101 %package osd-ldiskfs
102 Summary: osd-ldiskfs is the mandatory glue for LDISKFS support in Lustre.
103 Requires: lustre-modules = %{version}, lustre-ldiskfs
104 Provides: lustre-osd
105 Group: Development/Kernel
106
107 %description osd-ldiskfs
108 The Lustre Object Storage Device (OSD) API is the interface to access and
109 modify data that is supposed to be stored persistently. This API is the interface
110 to code that bridges individual file systems. This specific package provides an
111 implementation of the OSD API for using the Ldiskfs filesystem as the underlying
112 backing store of a Lustre server.
113 %endif
114
115 %if %{build_lustre_osd_zfs}
116 %package osd-zfs
117 Summary: osd-zfs is the mandatory glue for ZFS support in Lustre.
118 Requires: lustre-modules = %{version}, zfs-modules
119 Provides: lustre-osd
120 Group: Development/Kernel
121
122 %description osd-zfs
123 The Lustre Object Storage Device (OSD) API is the interface to access and
124 modify data that is supposed to be stored persistently. This API is the interface
125 to code that bridges individual file systems. This specific package provides an
126 implementation of the OSD API for using the ZFS filesystem as the underlying
127 backing store of a Lustre server.
128 %endif
129
130 %package source
131 Summary: Object-Based Disk storage driver source
132 Group: Development/Kernel
133
134 %description source
135 Lustre sources for further development
136
137 # Since the RPMs we ship are to be used on both SLES and RHEL, we
138 # can't include any dependency information (since the package names
139 # are different on the two platforms).
140 #
141 # Instead, we can build these empty meta-packages that only include
142 # dependency information.  These let people get the correct
143 # dependencies for their platform and lets them use tools like yum and
144 # red carpet to install the correct files.
145 #
146 # Unfortunately I have not seen this come up on the lists much, so I
147 # have disabled them (by commenting out their empty files section
148 # below) until it's clear that they resolve more confusion than they
149 # add.
150
151 %package deps-sles
152 Summary: Lustre dependencies meta-package for SLES
153 Group: Utilities/System
154 Provides: lustre-deps = %{version}
155 Requires: %{name} = %{version}, sles-release
156 Conflicts: %{name}-deps-rhel
157
158 %description deps-sles
159 This package has RPM dependencies appropriate for SLES systems.
160
161 %package deps-rhel
162 Summary: Lustre dependencies meta-package for RHEL
163 Group: Utilities/System
164 Provides: lustre-deps = %{version}
165 Requires: %{name} = %{version}, redhat-release
166 Conflicts: %{name}-deps-sles
167
168 %description deps-rhel
169 This package has RPM dependencies appropriate for RHEL, RHL, and FC
170 systems.
171
172 %package tests
173 Summary: Lustre testing framework
174 Group: Development/Kernel
175 Provides: %{name}-tests = %{version}
176 Requires: %{name} = %{version}, %{name}-modules = %{version}
177
178 %description tests
179 This package contains a set of test binaries and scripts that are intended
180 to be used by the Lustre testing framework.
181
182 %if 0%{?suse_version}
183 %debug_package
184 %endif
185 %prep
186 %setup -qn lustre-%{version}
187 ln lustre/ChangeLog ChangeLog-lustre
188 ln lnet/ChangeLog ChangeLog-lnet
189
190 %build
191 # if RPM_BUILD_NCPUS unset, set it
192 if [ -z "$RPM_BUILD_NCPUS" ] ; then
193     RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat 2>/dev/null || echo 0 :)
194     if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
195         RPM_BUILD_NCPUS=1
196     fi
197     if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
198         RPM_BUILD_NCPUS=8
199     fi
200 fi
201
202 rm -rf $RPM_BUILD_ROOT
203
204 # Set an explicit path to our Linux tree, if we can.
205 cd $RPM_BUILD_DIR/lustre-%{version}
206 # override %optflags so that the vendor's overzealous flags don't create
207 # build failures
208 %define optflags -g -O2 -Werror
209 CONFIGURE_ARGS="%{?configure_args} --with-release=%release"
210 %if %{build_lustre_tests}
211 CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-tests --enable-liblustre-tests"
212 %else
213 CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-tests --disable-liblustre-tests"
214 %endif
215
216 # if %%kdir was given, make sure it's not in the configure arguments
217 if [ -n "%kdir" ]; then
218         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux=[^ ][^ ]* \?//')
219 fi
220 # ditto for %%kobjdir
221 if [ -n "%kobjdir" ]; then
222         CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux-obj=[^ ][^ ]* \?//')
223 fi
224
225 # we need to eval "configure" because $CONFIGURE_ARGS could have a quoted
226 # string in it which we don't want word splitted by the shell
227 %define eval_configure %(echo '%configure' | sed -e 's#\./configure#eval ./configure#')
228
229 %eval_configure \
230         %{?kdir: --with-linux=%kdir} %{?kobjdir: --with-linux-obj=%kobjdir} \
231         $CONFIGURE_ARGS
232 make -j $RPM_BUILD_NCPUS -s
233
234 %install
235 make install DESTDIR=$RPM_BUILD_ROOT
236 # hack to avoid changing the libsysio code for "make install"
237 rm -f $RPM_BUILD_ROOT%{_libdir}/libsysio.a
238 # Remove ldiskfs module(s) - they are packaged by the ldiskfs .spec.
239 rm -rf $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre-ldiskfs
240
241 # hack to include the llog_test module in lustre-tests
242 llog_base=$RPM_BUILD_DIR/lustre-%{version}/lustre/obdclass/llog_test
243 if [ -e ${llog_base}.ko ]; then
244   cp ${llog_base}.ko $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre
245 elif [ -e ${llog_base}.o ]; then
246   cp ${llog_base}.o $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates/kernel/fs/lustre
247 fi
248
249 # The .ha_v2 extension identifies the heartbeat resource agent as using
250 # legacy syntax. Install a compatibility symlink to avoid conflicts when
251 # newer-style agents are added.
252 ln -s Lustre.ha_v2 $RPM_BUILD_ROOT/etc/ha.d/resource.d/Lustre
253
254 # Create the pristine source directory.
255 cd $RPM_BUILD_DIR/lustre-%{version}
256 mkdir -p $RPM_BUILD_ROOT/usr/src
257 rm -f lustre-source
258 ln -s $RPM_BUILD_ROOT/usr/src lustre-source
259 make distdir distdir=lustre-source/lustre-%{version}
260 chmod -R go-w lustre-source/lustre-%{version}
261 # fc18 needs 'x' permission for library files
262 find $RPM_BUILD_ROOT -name '*.so' | xargs chmod +x
263
264 cat >lustre.files <<EOF
265 %attr(-, root, root) /sbin/mount.lustre
266 %attr(-, root, root) /usr/sbin/*
267 %attr(-, root, root) /usr/bin/*
268
269 %attr(-, root, root) /usr/share/lustre
270
271 %attr(-, root, root) %{_libdir}/libptlctl.a
272 %attr(-, root, root) %{_libdir}/liblustreapi.a
273 %attr(-, root, root) %{_libdir}/liblustreapi.so
274 %attr(-, root, root) /usr/include/lustre
275 %attr(-, root, root) /usr/include/libcfs
276
277 %attr(-, root, root) %{_mandir}/man?/*
278
279 %attr(-, root, root) %{_libexecdir}/lustre/lc_common
280
281 %attr(-, root, root) %{_sysconfdir}/udev/rules.d/99-lustre.rules
282
283 %attr(-, root, root) %{_sysconfdir}/init.d/lnet
284 %attr(-, root, root) %{_sysconfdir}/init.d/lustre
285 %attr(-, root, root) %config(noreplace) %{_sysconfdir}/ldev.conf
286 %attr(-, root, root) %{_sysconfdir}/sysconfig/lustre
287 %attr(-, root, root) %{_libexecdir}/lustre/haconfig
288 %attr(-, root, root) %{_sysconfdir}/ha.d/resource.d/Lustre.ha_v2
289 %attr(-, root, root) %{_sysconfdir}/ha.d/resource.d/Lustre
290 EOF
291
292 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
293   echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
294 fi
295
296 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
297   echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
298   echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
299 fi
300
301 if [ -f $RPM_BUILD_ROOT%{_libdir}/libiam.a ] ; then
302   echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
303 fi
304
305 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
306   echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
307   echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
308 fi
309
310 # Have universal lustre headers
311 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
312   echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
313 else
314   echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
315 fi
316
317 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
318   echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
319 fi
320
321 %if %{build_lustre_tests}
322 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
323 echo '%attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
324 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
325   echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
326 fi
327 %endif
328
329 # mark modules executable for find-debuginfo.sh
330 find $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates -name "*.ko" -type f | \
331         xargs --no-run-if-empty chmod u+x
332
333 %files -f lustre.files
334
335 %files modules
336 %attr(-, root, root) /lib/modules/%{kversion}/updates/*
337 %if %{build_lustre_tests}
338 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.ko
339 %endif
340 %if %{build_lustre_osd_ldiskfs}
341 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
342 %endif
343 %if %{build_lustre_osd_zfs}
344 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko
345 %endif
346 %attr(-, root, root) %doc COPYING
347 %attr(-, root, root) %doc ChangeLog-lustre
348 %attr(-, root, root) %doc ChangeLog-lnet
349
350 %if %{build_lustre_osd_ldiskfs}
351 %files osd-ldiskfs
352 %attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
353 %endif
354
355 %if %{build_lustre_osd_zfs}
356 %files osd-zfs
357 %attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko
358 %endif
359
360 %files source
361 %attr(-, root, root) /usr/src/lustre-%{version}
362
363 # uncomment these lines to enable deps packages
364 # %files deps-sles
365 # %files deps-rhel
366
367 %if %{build_lustre_tests}
368 %files tests -f lustre-tests.files
369 %endif
370
371 %post modules
372 if [ -f /boot/System.map-%{kversion} ]; then
373         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
374 else
375         depmod -ae %{kversion} || exit 0
376 fi
377
378 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
379 # "weak modules" support
380 # Suse
381 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
382     rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
383         /usr/lib/module-init-tools/weak-modules --add-modules
384 fi
385 # RedHat
386 if [ -x /sbin/weak-modules ]; then
387     rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
388         /sbin/weak-modules --add-modules
389 fi
390
391 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
392 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
393 # print a warning so that users are aware of this issue.
394 if sysctl kernel.unsupported >/dev/null 2>&1 &&
395    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
396     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
397      echo "
398      warning: the Lustre modules are not supported by Novell. To use Lustre
399               on this system, you should put
400
401      allow_unsupported_modules 1
402
403      into /etc/modprobe.d/unsupported_modules"
404 fi
405
406 %if %{build_lustre_osd_ldiskfs}
407 %post osd-ldiskfs
408 if [ -f /boot/System.map-%{kversion} ]; then
409        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
410 else
411        depmod -ae %{kversion} || exit 0
412 fi
413
414 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
415 # "weak modules" support
416 # Suse
417 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
418     rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
419         /usr/lib/module-init-tools/weak-modules --add-modules
420 fi
421 # RedHat
422 if [ -x /sbin/weak-modules ]; then
423     rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
424         /sbin/weak-modules --add-modules
425 fi
426
427 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
428 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
429 # print a warning so that users are aware of this issue.
430 if sysctl kernel.unsupported >/dev/null 2>&1 &&
431    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
432     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
433      echo "
434      warning: the Lustre modules are not supported by Novell. To use Lustre
435               on this system, you should put
436
437      allow_unsupported_modules 1
438
439      into /etc/modprobe.d/unsupported_modules"
440 fi
441 %endif
442
443 %if %{build_lustre_osd_zfs}
444 %post osd-zfs
445 if [ -f /boot/System.map-%{kversion} ]; then
446        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
447 else
448        depmod -ae %{kversion} || exit 0
449 fi
450
451 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
452 # "weak modules" support
453 # Suse
454 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
455     rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
456         /usr/lib/module-init-tools/weak-modules --add-modules
457 fi
458 # RedHat
459 if [ -x /sbin/weak-modules ]; then
460     rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
461         /sbin/weak-modules --add-modules
462 fi
463
464 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
465 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
466 # print a warning so that users are aware of this issue.
467 if sysctl kernel.unsupported >/dev/null 2>&1 &&
468    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
469     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
470      echo "
471      warning: the Lustre modules are not supported by Novell. To use Lustre
472               on this system, you should put
473
474      allow_unsupported_modules 1
475
476      into /etc/modprobe.d/unsupported_modules"
477 fi
478 %endif
479
480 %preun modules
481 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
482 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' > /var/run/%{name}-modules || true
483
484 %if %{build_lustre_osd_ldiskfs}
485 %preun osd-ldiskfs
486 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
487 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-ldiskfs || true
488 %endif
489
490 %if %{build_lustre_osd_zfs}
491 %preun osd-zfs
492 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
493 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-zfs || true
494 %endif
495
496 %postun modules
497 if [ -f /boot/System.map-%{kversion} ]; then
498         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
499 else
500         depmod -ae %{kversion} || exit 0
501 fi
502
503 # "weak modules" support
504 # Suse
505 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
506     cat /var/run/%{name}-modules |
507         /usr/lib/module-init-tools/weak-modules --remove-modules
508 fi
509 # RedHat
510 if [ -x /sbin/weak-modules ]; then
511     cat /var/run/%{name}-modules |
512         /sbin/weak-modules --remove-modules
513 fi
514 rm /var/run/%{name}-modules
515
516 %if %{build_lustre_osd_ldiskfs}
517 %postun osd-ldiskfs
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 # "weak modules" support
525 # Suse
526 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
527     cat /var/run/%{name}-osd-ldiskfs |
528         /usr/lib/module-init-tools/weak-modules --remove-modules
529 fi
530 # RedHat
531 if [ -x /sbin/weak-modules ]; then
532     cat /var/run/%{name}-osd-ldiskfs |
533         /sbin/weak-modules --remove-modules
534 fi
535 rm /var/run/%{name}-osd-ldiskfs
536 %endif
537
538 %if %{build_lustre_osd_zfs}
539 %postun osd-zfs
540 if [ -f /boot/System.map-%{kversion} ]; then
541        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
542 else
543        depmod -ae %{kversion} || exit 0
544 fi
545
546 # "weak modules" support
547 # Suse
548 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
549     cat /var/run/%{name}-osd-zfs |
550         /usr/lib/module-init-tools/weak-modules --remove-modules
551 fi
552 # RedHat
553 if [ -x /sbin/weak-modules ]; then
554     cat /var/run/%{name}-osd-zfs |
555         /sbin/weak-modules --remove-modules
556 fi
557 rm /var/run/%{name}-osd-zfs
558 %endif
559
560 %if %{build_lustre_tests}
561 %post tests
562 if [ -f /boot/System.map-%{kversion} ]; then
563         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
564 else
565         depmod -ae %{kversion} || exit 0
566 fi
567
568 %postun tests
569 if [ -f /boot/System.map-%{kversion} ]; then
570         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
571 else
572         depmod -ae %{kversion} || exit 0
573 fi
574 %endif
575
576 %clean
577 rm -rf $RPM_BUILD_ROOT