forked from Xyratex/lustre-stable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lustre-dkms.spec.in
154 lines (132 loc) · 4.66 KB
/
lustre-dkms.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
%bcond_without servers
# Set the package name prefix
%if %{with servers}
%define module @PACKAGE@
%else
%define module @PACKAGE@-client
%endif
%define buildid 1
Name: %{module}-dkms
Version: @VERSION@
Release: %{buildid}%{?dist}
Summary: Kernel module(s) (dkms)
Group: System Environment/Kernel
License: GPLv2+
URL: http://lustre.opensfs.org/
Source0: @PACKAGE@-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# DKMS >= 2.2.0.3-28.git.7c3e7c5 to fully support inter-modules deps
# (ie, "BUILD_DEPENDS[#]=<pkg>"), and have latest DKMS fixes integrated
# for bugs that prevented our module to build/install.
Requires: dkms >= 2.2.0.3-28.git.7c3e7c5
%if %{with servers}
# Only zfs Lustre DKMS Server is supported
Requires: spl-dkms >= 0.6.1
Requires: zfs-dkms >= 0.6.1
Requires: %{module}-osd-zfs-mount
%endif
Requires: gcc, make, perl
Requires: kernel-devel
Provides: %{module}-kmod = %{version}
Provides: %{module}-modules = %{version}
%if %{with servers}
# Only zfs Lustre DKMS Server is supported
Provides: %{module}-osd-zfs = %{version}
Provides: %{module}-osd
%endif
%description
This package contains the dkms Lustre kernel modules.
%prep
%setup -q -n @PACKAGE@-%{version}
%build
cat << EOF > dkms.conf
# Embryonic lustre-dkms dkms.conf to allow for on-target accurate and full
# version re-create during first dkms add stage.
PACKAGE_NAME=%{module}
PACKAGE_VERSION=%{version}
POST_ADD="lustre-dkms_post-add.sh \$module \$module_version \$kernelver \
\$kernel_source_dir \$arch \$source_tree \$dkms_tree"
# at least one DEST_MODULE_LOCATION[] element, along with an install
# path made of either "extra" or "updates" subdir, are required during
# dkms.conf validity check of "dkms add" step.
DEST_MODULE_LOCATION[${#DEST_MODULE_LOCATION[@]}]="/extra/lnet/"
EOF
cat << EOF > lustre-dkms_post-add.sh
#!/bin/bash
# \$1 : \$module
# \$2 : \$module_version
# \$3 : \$kernelver
# \$4 : \$kernel_source_dir
# \$5 : \$arch
# \$6 : \$source_tree
# \$7 : \$dkms_tree
if [ \$1 = "lustre-client" ] ; then
SERVER="--disable-server"
else
SPL_VERSION=\$(dkms status -m spl -k \$3/\$5 | awk -F', ' '{print \$2; exit 0}' | sed 's/: added\\\$//')
ZFS_VERSION=\$(dkms status -m zfs -k \$3/\$5 | awk -F', ' '{print \$2; exit 0}' | sed 's/: added\\\$//')
SERVER="--enable-server --disable-ldiskfs --with-linux=\$4 --with-linux-obj=\$4 \\
--with-spl=\$6/spl-\${SPL_VERSION} \\
--with-spl-obj=\$7/spl/\${SPL_VERSION}/\$3/\$5 \\
--with-zfs=\$6/zfs-\${ZFS_VERSION} \\
--with-zfs-obj=\$7/zfs/\${ZFS_VERSION}/\$3/\$5"
fi
rpm -qa | grep krb5-devel >/dev/null
if [ \$? == 0 ] ; then
GSS="--enable-gss"
else
GSS="--disable-gss"
fi
# run a configure pass to clean "--enable-dist" only effect and also to
# ensure local/on-target environment to be taken into account
./configure --enable-modules --disable-iokit --disable-snmp --disable-doc \\
--disable-utils --disable-tests --disable-maintainer-mode \\
\$GSS \$SERVER \\
--disable-manpages --disable-dlc
# re-create dkms.conf based on this
lustre/scripts/dkms.mkconf -n \$1 -v \$2 -f ./dkms.conf
EOF
chmod 755 lustre-dkms_post-add.sh
sed -i 's/BUILDID[[:print:]]*/BUILDID = %{buildid}/' META
sed -i 's/PRISTINE[[:print:]]*/PRISTINE = 1/' META
cp META ldiskfs/META
%install
if [ "$RPM_BUILD_ROOT" != "/" ]; then
rm -rf $RPM_BUILD_ROOT
fi
mkdir -p $RPM_BUILD_ROOT/usr/src/
cp -rfp ${RPM_BUILD_DIR}/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/
%if %{without servers}
# To have the directory reflect the DKMS RPM name!
mv $RPM_BUILD_ROOT/usr/src/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/%{module}-%{version}
%endif
%clean
if [ "$RPM_BUILD_ROOT" != "/" ]; then
rm -rf $RPM_BUILD_ROOT
fi
%files
%defattr(-,root,root)
/usr/src/%{module}-%{version}
%post
for POSTINST in /usr/lib/dkms/common.postinst; do
if [ -f $POSTINST ]; then
$POSTINST %{module} %{version}
exit $?
fi
echo "WARNING: $POSTINST does not exist."
done
echo -e "ERROR: DKMS version is too old and %{module} was not"
echo -e "built with legacy DKMS support."
echo -e "You must either rebuild %{module} with legacy postinst"
echo -e "support or upgrade DKMS to a more current version."
exit 1
%preun
dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
exit 0
%changelog
* Wed Oct 7 2015 Bruno Faccini <[email protected]>
- adapted for Lustre Client DKMS creation
- allow for on-target reconfig to prevent static deps requires
* Fri Apr 8 2013 Brian Behlendorf <[email protected]> - 2.3.63-1
- First DKMS packages.