3 # Set the package name prefix
5 %define module @PACKAGE@
7 %define module @PACKAGE@-client
10 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
11 %global requires_kmod_name kmod-%{module}
13 %global requires_kmod_name %{module}-kmp
21 Release: %{buildid}%{?dist}
22 Summary: Kernel module(s) (dkms)
24 Group: System Environment/Kernel
26 URL: http://lustre.opensfs.org/
27 Source0: @PACKAGE@-%{version}.tar.gz
28 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
31 # DKMS >= 2.2.0.3-28.git.7c3e7c5 to fully support inter-modules deps
32 # (ie, "BUILD_DEPENDS[#]=<pkg>"), and have latest DKMS fixes integrated
33 # for bugs that prevented our module to build/install.
34 Requires: dkms >= 2.2.0.3-28.git.7c3e7c5
36 # Only zfs Lustre DKMS Server is supported
37 Requires: spl-dkms >= 0.6.1
38 Requires: zfs-dkms >= 0.6.1
39 Requires: %{module}-osd-zfs-mount
41 Requires: gcc, make, perl
42 Requires: kernel-devel
43 Provides: %{requires_kmod_name} = %{version}
44 Provides: %{module}-modules = %{version}
46 # Only zfs Lustre DKMS Server is supported
47 Provides: %{module}-osd-zfs = %{version}
48 Provides: %{module}-osd
52 This package contains the dkms Lustre kernel modules.
55 %setup -q -n @PACKAGE@-%{version}
58 cat << EOF > dkms.conf
59 # Embryonic lustre-dkms dkms.conf to allow for on-target accurate and full
60 # version re-create during first run of Lustre DKMS module build step.
61 PACKAGE_NAME=%{module}
62 PACKAGE_VERSION=%{version}
63 PACKAGE_CONFIG="/etc/sysconfig/lustre"
64 PRE_BUILD="lustre-dkms_pre-build.sh \$module \$module_version \$kernelver \
65 \$kernel_source_dir \$arch \$source_tree \$dkms_tree"
66 POST_BUILD="lustre-dkms_post-build.sh \$module \$module_version \$kernelver \
67 \$kernel_source_dir \$arch \$source_tree \$dkms_tree"
70 cat << EOF >> dkms.conf
71 BUILD_DEPENDS[0]="zfs"
74 cat << EOF >> dkms.conf
78 # just have to set STRIP[0], it will become the new default.
80 [[ -r \${PACKAGE_CONFIG} ]] \\
81 && source \${PACKAGE_CONFIG} \\
82 && shopt -q -s extglob \\
83 && [[ \${LUSTRE_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \\
87 # at least one module's set of BUILT_MODULE_NAME[]/BUILT_MODULE_LOCATION[]
88 # elements, along with an install path made of either "extra" or "updates"
89 # subdir in its DEST_MODULE_LOCATION[] element, are required to fake during
90 # dkms.conf validity checks of "dkms [add,build]" steps.
91 # Final/full correct BUILT_MODULE_NAME[]/BUILT_MODULE_LOCATION[]/
92 # DEST_MODULE_LOCATION[] sets of values for all modules will be fixed during
93 # on-target post-configure run of dkms.mkconf as part of build step.
94 # it must be for a module shared by both lustre[-client]-dkms packages.
95 BUILT_MODULE_NAME[\${#BUILT_MODULE_NAME[@]}]="lustre"
96 BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/llite/"
97 DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/extra/lustre/"
101 if [ "$RPM_BUILD_ROOT" != "/" ]; then
102 rm -rf $RPM_BUILD_ROOT
104 mkdir -p $RPM_BUILD_ROOT/usr/src/
105 cp -rfp ${RPM_BUILD_DIR}/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/
106 %if %{without servers}
107 # To have the directory reflect the DKMS RPM name!
108 mv $RPM_BUILD_ROOT/usr/src/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/%{module}-%{version}
112 if [ "$RPM_BUILD_ROOT" != "/" ]; then
113 rm -rf $RPM_BUILD_ROOT
117 %defattr(-,root,root)
118 /usr/src/%{module}-%{version}
121 for POSTINST in /usr/lib/dkms/common.postinst; do
122 if [ -f $POSTINST ]; then
123 $POSTINST %{module} %{version}
126 echo "WARNING: $POSTINST does not exist."
128 echo -e "ERROR: DKMS version is too old and %{module} was not"
129 echo -e "built with legacy DKMS support."
130 echo -e "You must either rebuild %{module} with legacy postinst"
131 echo -e "support or upgrade DKMS to a more current version."
135 dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
139 * Sat Jan 23 2016 Bruno Faccini <bruno.faccini@intel.com>
140 - detect and handle cases where [spl,zfs]-dkms packages are not built
141 - also handle on-target configure issues
142 * Wed Oct 7 2015 Bruno Faccini <bruno.faccini@intel.com>
143 - adapted for Lustre Client DKMS creation
144 - allow for on-target reconfig to prevent static deps requires
145 * Fri Apr 8 2013 Brian Behlendorf <behlendorf1@llnl.gov> - 2.3.63-1
146 - First DKMS packages.