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