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