Whamcloud - gitweb
LU-2792 fld: add dot_seq into in_fldb 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 1}
24 %{!?build_lustre_osd_zfs: %global build_lustre_osd_zfs 1}
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
262 cat >lustre.files <<EOF
263 %attr(-, root, root) /sbin/mount.lustre
264 %attr(-, root, root) /usr/sbin/*
265 %attr(-, root, root) /usr/bin/*
266
267 %attr(-, root, root) /usr/share/lustre
268
269 %attr(-, root, root) %{_libdir}/libptlctl.a
270 %attr(-, root, root) %{_libdir}/liblustreapi.a
271 %attr(-, root, root) %{_libdir}/liblustreapi.so
272 %attr(-, root, root) /usr/include/lustre
273 %attr(-, root, root) /usr/include/libcfs
274
275 %attr(-, root, root) %{_mandir}/man?/*
276
277 %attr(-, root, root) %{_libexecdir}/lustre/lc_common
278
279 %attr(-, root, root) %{_sysconfdir}/udev/rules.d/99-lustre.rules
280
281 %attr(-, root, root) %{_sysconfdir}/init.d/lnet
282 %attr(-, root, root) %{_sysconfdir}/init.d/lustre
283 %attr(-, root, root) %config(noreplace) %{_sysconfdir}/ldev.conf
284 %attr(-, root, root) %{_sysconfdir}/sysconfig/lustre
285 %attr(-, root, root) %{_libexecdir}/lustre/haconfig
286 %attr(-, root, root) %{_sysconfdir}/ha.d/resource.d/Lustre.ha_v2
287 %attr(-, root, root) %{_sysconfdir}/ha.d/resource.d/Lustre
288 EOF
289
290 if [ -f $RPM_BUILD_ROOT%{_libdir}/libcfsutil.a ] ; then
291   echo '%attr(-, root, root) %{_libdir}/libcfsutil.a' >>lustre.files
292 fi
293
294 if [ -f $RPM_BUILD_ROOT%{_libdir}/liblustre.so ] ; then
295   echo '%attr(-, root, root) %{_libdir}/liblustre.a' >>lustre.files
296   echo '%attr(-, root, root) %{_libdir}/liblustre.so' >>lustre.files
297 fi
298
299 if [ -f $RPM_BUILD_ROOT%{_libdir}/libiam.a ] ; then
300   echo '%attr(-, root, root) %{_libdir}/libiam.a' >>lustre.files
301 fi
302
303 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/snmp ] ; then
304   echo '%attr(-, root, root) %{_libdir}/lustre/snmp' >>lustre.files
305   echo '%attr(-, root, root) %{_datadir}/lustre/snmp/mibs' >>lustre.files
306 fi
307
308 # Have universal lustre headers
309 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/lustre/lustre_idl.h ] ; then
310   echo '%attr(-, root, root) /usr/include/linux/lustre_user.h' >>lustre.files
311 else
312   echo '%attr(-, root, root) /usr/include/linux/lustre_idl.h' >>lustre.files
313 fi
314
315 if [ -f $RPM_BUILD_DIR/lustre-%{version}/lustre/include/linux/lustre_types.h ] ; then
316   echo '%attr(-, root, root) /usr/include/linux/lustre_types.h' >>lustre.files
317 fi
318
319 %if %{build_lustre_tests}
320 echo '%attr(-, root, root) %{_libdir}/lustre/tests/*' >lustre-tests.files
321 echo '%attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.*' >>lustre-tests.files
322 if [ -d $RPM_BUILD_ROOT%{_libdir}/lustre/liblustre/tests ] ; then
323   echo '%attr(-, root, root) %{_libdir}/lustre/liblustre/tests/*' >>lustre-tests.files
324 fi
325 %endif
326
327 # mark modules executable for find-debuginfo.sh
328 find $RPM_BUILD_ROOT/lib/modules/%{kversion}/updates -name "*.ko" -type f | \
329         xargs --no-run-if-empty chmod u+x
330
331 %files -f lustre.files
332
333 %files modules
334 %attr(-, root, root) /lib/modules/%{kversion}/updates/*
335 %if %{build_lustre_tests}
336 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/llog_test.ko
337 %endif
338 %if %{build_lustre_osd_ldiskfs}
339 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
340 %endif
341 %if %{build_lustre_osd_zfs}
342 %exclude /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko
343 %endif
344 %attr(-, root, root) %doc COPYING
345 %attr(-, root, root) %doc ChangeLog-lustre
346 %attr(-, root, root) %doc ChangeLog-lnet
347
348 %if %{build_lustre_osd_ldiskfs}
349 %files osd-ldiskfs
350 %attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_ldiskfs.ko
351 %endif
352
353 %if %{build_lustre_osd_zfs}
354 %files osd-zfs
355 %attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre/osd_zfs.ko
356 %endif
357
358 %files source
359 %attr(-, root, root) /usr/src/lustre-%{version}
360
361 # uncomment these lines to enable deps packages
362 # %files deps-sles
363 # %files deps-rhel
364
365 %if %{build_lustre_tests}
366 %files tests -f lustre-tests.files
367 %endif
368
369 %post modules
370 if [ -f /boot/System.map-%{kversion} ]; then
371         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
372 else
373         depmod -ae %{kversion} || exit 0
374 fi
375
376 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
377 # "weak modules" support
378 # Suse
379 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
380     rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
381         /usr/lib/module-init-tools/weak-modules --add-modules
382 fi
383 # RedHat
384 if [ -x /sbin/weak-modules ]; then
385     rpm -ql $MODULES_RPM_NAME | grep '\.ko$' |
386         /sbin/weak-modules --add-modules
387 fi
388
389 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
390 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
391 # print a warning so that users are aware of this issue.
392 if sysctl kernel.unsupported >/dev/null 2>&1 &&
393    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
394     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
395      echo "
396      warning: the Lustre modules are not supported by Novell. To use Lustre
397               on this system, you should put
398
399      allow_unsupported_modules 1
400
401      into /etc/modprobe.d/unsupported_modules"
402 fi
403
404 %if %{build_lustre_osd_ldiskfs}
405 %post osd-ldiskfs
406 if [ -f /boot/System.map-%{kversion} ]; then
407        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
408 else
409        depmod -ae %{kversion} || exit 0
410 fi
411
412 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
413 # "weak modules" support
414 # Suse
415 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
416     rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
417         /usr/lib/module-init-tools/weak-modules --add-modules
418 fi
419 # RedHat
420 if [ -x /sbin/weak-modules ]; then
421     rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' |
422         /sbin/weak-modules --add-modules
423 fi
424
425 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
426 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
427 # print a warning so that users are aware of this issue.
428 if sysctl kernel.unsupported >/dev/null 2>&1 &&
429    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
430     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
431      echo "
432      warning: the Lustre modules are not supported by Novell. To use Lustre
433               on this system, you should put
434
435      allow_unsupported_modules 1
436
437      into /etc/modprobe.d/unsupported_modules"
438 fi
439 %endif
440
441 %if %{build_lustre_osd_zfs}
442 %post osd-zfs
443 if [ -f /boot/System.map-%{kversion} ]; then
444        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
445 else
446        depmod -ae %{kversion} || exit 0
447 fi
448
449 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
450 # "weak modules" support
451 # Suse
452 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
453     rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
454         /usr/lib/module-init-tools/weak-modules --add-modules
455 fi
456 # RedHat
457 if [ -x /sbin/weak-modules ]; then
458     rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' |
459         /sbin/weak-modules --add-modules
460 fi
461
462 # If the kernel was built to reject unsupported modules (e.g. not a Lustre
463 # kernel), and this hasn't been overridden in /etc/modprobe.d yet, then
464 # print a warning so that users are aware of this issue.
465 if sysctl kernel.unsupported >/dev/null 2>&1 &&
466    [ "$(sysctl -n kernel.unsupported 2>/dev/null)" = "0" ] &&
467     ! modprobe -c | grep -q "^allow_unsupported_modules[ \t]1" ; then
468      echo "
469      warning: the Lustre modules are not supported by Novell. To use Lustre
470               on this system, you should put
471
472      allow_unsupported_modules 1
473
474      into /etc/modprobe.d/unsupported_modules"
475 fi
476 %endif
477
478 %preun modules
479 MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}")
480 rpm -ql $MODULES_RPM_NAME | grep '\.ko$' > /var/run/%{name}-modules || true
481
482 %if %{build_lustre_osd_ldiskfs}
483 %preun osd-ldiskfs
484 OSD_LDISKFS_RPM_NAME=$(rpm -q %{name}-osd-ldiskfs | grep "%{version}-%{release}")
485 rpm -ql $OSD_LDISKFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-ldiskfs || true
486 %endif
487
488 %if %{build_lustre_osd_zfs}
489 %preun osd-zfs
490 OSD_ZFS_RPM_NAME=$(rpm -q %{name}-osd-zfs | grep "%{version}-%{release}")
491 rpm -ql $OSD_ZFS_RPM_NAME | grep '\.ko$' > /var/run/%{name}-osd-zfs || true
492 %endif
493
494 %postun modules
495 if [ -f /boot/System.map-%{kversion} ]; then
496         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
497 else
498         depmod -ae %{kversion} || exit 0
499 fi
500
501 # "weak modules" support
502 # Suse
503 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
504     cat /var/run/%{name}-modules |
505         /usr/lib/module-init-tools/weak-modules --remove-modules
506 fi
507 # RedHat
508 if [ -x /sbin/weak-modules ]; then
509     cat /var/run/%{name}-modules |
510         /sbin/weak-modules --remove-modules
511 fi
512 rm /var/run/%{name}-modules
513
514 %if %{build_lustre_osd_ldiskfs}
515 %postun osd-ldiskfs
516 if [ -f /boot/System.map-%{kversion} ]; then
517        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
518 else
519        depmod -ae %{kversion} || exit 0
520 fi
521
522 # "weak modules" support
523 # Suse
524 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
525     cat /var/run/%{name}-osd-ldiskfs |
526         /usr/lib/module-init-tools/weak-modules --remove-modules
527 fi
528 # RedHat
529 if [ -x /sbin/weak-modules ]; then
530     cat /var/run/%{name}-osd-ldiskfs |
531         /sbin/weak-modules --remove-modules
532 fi
533 rm /var/run/%{name}-osd-ldiskfs
534 %endif
535
536 %if %{build_lustre_osd_zfs}
537 %postun osd-zfs
538 if [ -f /boot/System.map-%{kversion} ]; then
539        depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
540 else
541        depmod -ae %{kversion} || exit 0
542 fi
543
544 # "weak modules" support
545 # Suse
546 if [ -x /usr/lib/module-init-tools/weak-modules ]; then
547     cat /var/run/%{name}-osd-zfs |
548         /usr/lib/module-init-tools/weak-modules --remove-modules
549 fi
550 # RedHat
551 if [ -x /sbin/weak-modules ]; then
552     cat /var/run/%{name}-osd-zfs |
553         /sbin/weak-modules --remove-modules
554 fi
555 rm /var/run/%{name}-osd-zfs
556 %endif
557
558 %if %{build_lustre_tests}
559 %post tests
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 %postun tests
567 if [ -f /boot/System.map-%{kversion} ]; then
568         depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
569 else
570         depmod -ae %{kversion} || exit 0
571 fi
572 %endif
573
574 %clean
575 rm -rf $RPM_BUILD_ROOT