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