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
40 # If client package is installed when installing server, remove it since
41 # the server package also includes the client. This can be removed if/when
42 # the packages are split into independent client/server/common packages.
43 Obsoletes: @PACKAGE@-client
45 Requires: gcc, make, perl
46 Requires: kernel-devel
47 Provides: %{requires_kmod_name} = %{version}
48 Provides: %{module}-modules = %{version}
50 # Only zfs Lustre DKMS Server is supported
51 Provides: %{module}-osd-zfs = %{version}
52 Provides: %{module}-osd
56 This package contains the dkms Lustre kernel modules.
59 %setup -q -n @PACKAGE@-%{version}
62 cat << EOF > dkms.conf
63 # Embryonic lustre-dkms dkms.conf to allow for on-target accurate and full
64 # version re-create during first run of Lustre DKMS module build step.
65 PACKAGE_NAME=%{module}
66 PACKAGE_VERSION=%{version}
67 PACKAGE_CONFIG="/etc/sysconfig/lustre"
68 PRE_BUILD="lustre-dkms_pre-build.sh \$module \$module_version \$kernelver \
69 \$kernel_source_dir \$arch \$source_tree \$dkms_tree"
70 POST_BUILD="lustre-dkms_post-build.sh \$module \$module_version \$kernelver \
71 \$kernel_source_dir \$arch \$source_tree \$dkms_tree"
74 cat << EOF >> dkms.conf
75 BUILD_DEPENDS[0]="zfs"
78 cat << EOF >> dkms.conf
82 # just have to set STRIP[0], it will become the new default.
84 [[ -r \${PACKAGE_CONFIG} ]] \\
85 && source \${PACKAGE_CONFIG} \\
86 && shopt -q -s extglob \\
87 && [[ \${LUSTRE_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \\
91 # at least one module's set of BUILT_MODULE_NAME[]/BUILT_MODULE_LOCATION[]
92 # elements, along with an install path made of either "extra" or "updates"
93 # subdir in its DEST_MODULE_LOCATION[] element, are required to fake during
94 # dkms.conf validity checks of "dkms [add,build]" steps.
95 # Final/full correct BUILT_MODULE_NAME[]/BUILT_MODULE_LOCATION[]/
96 # DEST_MODULE_LOCATION[] sets of values for all modules will be fixed during
97 # on-target post-configure run of dkms.mkconf as part of build step.
98 # it must be for a module shared by both lustre[-client]-dkms packages.
99 BUILT_MODULE_NAME[\${#BUILT_MODULE_NAME[@]}]="lustre"
100 BUILT_MODULE_LOCATION[\${#BUILT_MODULE_LOCATION[@]}]="lustre/llite/"
101 DEST_MODULE_LOCATION[\${#DEST_MODULE_LOCATION[@]}]="/extra/lustre/"
105 if [ "$RPM_BUILD_ROOT" != "/" ]; then
106 rm -rf $RPM_BUILD_ROOT
108 mkdir -p $RPM_BUILD_ROOT/usr/src/
109 cp -rfp ${RPM_BUILD_DIR}/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/
110 %if %{without servers}
111 # To have the directory reflect the DKMS RPM name!
112 mv $RPM_BUILD_ROOT/usr/src/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/%{module}-%{version}
116 if [ "$RPM_BUILD_ROOT" != "/" ]; then
117 rm -rf $RPM_BUILD_ROOT
121 %defattr(-,root,root)
122 /usr/src/%{module}-%{version}
125 for POSTINST in /usr/lib/dkms/common.postinst; do
126 if [ -f $POSTINST ]; then
127 $POSTINST %{module} %{version}
130 echo "WARNING: $POSTINST does not exist."
132 echo -e "ERROR: DKMS version is too old and %{module} was not"
133 echo -e "built with legacy DKMS support."
134 echo -e "You must either rebuild %{module} with legacy postinst"
135 echo -e "support or upgrade DKMS to a more current version."
139 dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
143 * Sat Jan 23 2016 Bruno Faccini <bruno.faccini@intel.com>
144 - detect and handle cases where [spl,zfs]-dkms packages are not built
145 - also handle on-target configure issues
146 * Wed Oct 7 2015 Bruno Faccini <bruno.faccini@intel.com>
147 - adapted for Lustre Client DKMS creation
148 - allow for on-target reconfig to prevent static deps requires
149 * Mon Apr 8 2013 Brian Behlendorf <behlendorf1@llnl.gov> - 2.3.63-1
150 - First DKMS packages.