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 dkms add stage.
55 PACKAGE_NAME=%{module}
56 PACKAGE_VERSION=%{version}
57 POST_ADD="lustre-dkms_post-add.sh \$module \$module_version \$kernelver \
58 \$kernel_source_dir \$arch \$source_tree \$dkms_tree"
59 # at least one DEST_MODULE_LOCATION[] element, along with an install
60 # path made of either "extra" or "updates" subdir, are required during
61 # dkms.conf validity check of "dkms add" step.
62 DEST_MODULE_LOCATION[${#DEST_MODULE_LOCATION[@]}]="/extra/lnet/"
65 cat << EOF > lustre-dkms_post-add.sh
68 # \$2 : \$module_version
70 # \$4 : \$kernel_source_dir
75 if [ \$1 = "lustre-client" ] ; then
76 SERVER="--disable-server"
78 SPL_VERSION=\$(dkms status -m spl -k \$3/\$5 | awk -F', ' '{print \$2; exit 0}' | sed 's/: added\\\$//')
79 ZFS_VERSION=\$(dkms status -m zfs -k \$3/\$5 | awk -F', ' '{print \$2; exit 0}' | sed 's/: added\\\$//')
81 SERVER="--enable-server --disable-ldiskfs --with-linux=\$4 --with-linux-obj=\$4 \\
82 --with-spl=\$6/spl-\${SPL_VERSION} \\
83 --with-spl-obj=\$7/spl/\${SPL_VERSION}/\$3/\$5 \\
84 --with-zfs=\$6/zfs-\${ZFS_VERSION} \\
85 --with-zfs-obj=\$7/zfs/\${ZFS_VERSION}/\$3/\$5"
88 rpm -qa | grep krb5-devel >/dev/null
89 if [ \$? == 0 ] ; then
95 # run a configure pass to clean "--enable-dist" only effect and also to
96 # ensure local/on-target environment to be taken into account
97 ./configure --enable-modules --disable-iokit --disable-snmp --disable-doc \\
98 --disable-utils --disable-tests --disable-maintainer-mode \\
100 --disable-manpages --disable-dlc
101 # re-create dkms.conf based on this
102 lustre/scripts/dkms.mkconf -n \$1 -v \$2 -f ./dkms.conf
105 chmod 755 lustre-dkms_post-add.sh
107 sed -i 's/BUILDID[[:print:]]*/BUILDID = %{buildid}/' META
108 sed -i 's/PRISTINE[[:print:]]*/PRISTINE = 1/' META
112 if [ "$RPM_BUILD_ROOT" != "/" ]; then
113 rm -rf $RPM_BUILD_ROOT
115 mkdir -p $RPM_BUILD_ROOT/usr/src/
116 cp -rfp ${RPM_BUILD_DIR}/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/
117 %if %{without servers}
118 # To have the directory reflect the DKMS RPM name!
119 mv $RPM_BUILD_ROOT/usr/src/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/%{module}-%{version}
123 if [ "$RPM_BUILD_ROOT" != "/" ]; then
124 rm -rf $RPM_BUILD_ROOT
128 %defattr(-,root,root)
129 /usr/src/%{module}-%{version}
132 for POSTINST in /usr/lib/dkms/common.postinst; do
133 if [ -f $POSTINST ]; then
134 $POSTINST %{module} %{version}
137 echo "WARNING: $POSTINST does not exist."
139 echo -e "ERROR: DKMS version is too old and %{module} was not"
140 echo -e "built with legacy DKMS support."
141 echo -e "You must either rebuild %{module} with legacy postinst"
142 echo -e "support or upgrade DKMS to a more current version."
146 dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
150 * Wed Oct 7 2015 Bruno Faccini <bruno.faccini@intel.com>
151 - adapted for Lustre Client DKMS creation
152 - allow for on-target reconfig to prevent static deps requires
153 * Fri Apr 8 2013 Brian Behlendorf <behlendorf1@llnl.gov> - 2.3.63-1
154 - First DKMS packages.