Whamcloud - gitweb
LU-9611 lov: allow lov.*.stripe{size,count}=-1 param
[fs/lustre-release.git] / lustre-dkms.spec.in
1 %bcond_without servers
2
3 # Set the package name prefix
4 %if %{with servers}
5     %define module  @PACKAGE@
6 %else
7     %define module  @PACKAGE@-client
8 %endif
9
10 %if %{_vendor}=="redhat" || %{_vendor}=="fedora"
11         %global requires_kmod_name kmod-%{module}
12         %define mkconf_options
13 %else   #for Suse / Ubuntu
14         %global requires_kmod_name %{module}-kmp
15         %define mkconf_options "-k updates"
16 %endif
17
18 %define buildid 1
19 %define mkconf  lustre/scripts/dkms.mkconf
20
21 Name:           %{module}-dkms
22
23 Version:        @VERSION@
24 Release:        %{buildid}%{?dist}
25 Summary:        Kernel module(s) (dkms)
26
27 Group:          System Environment/Kernel
28 License:        GPLv2+
29 URL:            http://lustre.opensfs.org/
30 Source0:        @PACKAGE@-%{version}.tar.gz
31 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
32 BuildArch:      noarch
33
34 # DKMS >= 2.2.0.3-28.git.7c3e7c5 to fully support inter-modules deps
35 # (ie, "BUILD_DEPENDS[#]=<pkg>"), and have latest DKMS fixes integrated
36 # for bugs that prevented our module to build/install.
37 Requires:       dkms >= 2.2.0.3-28.git.7c3e7c5
38 %if %{with servers}
39 # Only zfs Lustre DKMS Server is supported
40 Requires:       spl-dkms >= 0.6.1
41 Requires:       zfs-dkms >= 0.6.1
42 Requires:       %{module}-osd-zfs-mount
43 # If client package is installed when installing server, remove it since
44 # the server package also includes the client.  This can be removed if/when
45 # the packages are split into independent client/server/common packages.
46 Obsoletes:      @PACKAGE@-client < %{version}
47 %endif
48 Requires:       gcc, make, perl
49 Requires:       kernel-devel
50 Provides:       %{requires_kmod_name} = %{version}
51 Provides:       %{module}-modules = %{version}
52 %if %{with servers}
53 # Only zfs Lustre DKMS Server is supported
54 Provides:       %{module}-osd-zfs = %{version}
55 Provides:       %{module}-osd
56 %endif
57
58 %description
59 This package contains the dkms Lustre kernel modules.
60
61 %prep
62 %setup -q -n @PACKAGE@-%{version}
63
64 %build
65 %{mkconf} -n %{module} -v %{version} -f dkms.conf %{mkconf_options}
66
67 %install
68 if [ "$RPM_BUILD_ROOT" != "/" ]; then
69     rm -rf $RPM_BUILD_ROOT
70 fi
71 mkdir -p $RPM_BUILD_ROOT/usr/src/
72 cp -rfp ${RPM_BUILD_DIR}/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/
73 %if %{without servers}
74 # To have the directory reflect the DKMS RPM name!
75 mv $RPM_BUILD_ROOT/usr/src/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/%{module}-%{version}
76 %endif
77
78 %clean
79 if [ "$RPM_BUILD_ROOT" != "/" ]; then
80     rm -rf $RPM_BUILD_ROOT
81 fi
82
83 %files
84 %defattr(-,root,root)
85 /usr/src/%{module}-%{version}
86
87 %post
88 for POSTINST in /usr/lib/dkms/common.postinst; do
89     if [ -f $POSTINST ]; then
90         $POSTINST %{module} %{version}
91         exit $?
92     fi
93     echo "WARNING: $POSTINST does not exist."
94 done
95 echo -e "ERROR: DKMS version is too old and %{module} was not"
96 echo -e "built with legacy DKMS support."
97 echo -e "You must either rebuild %{module} with legacy postinst"
98 echo -e "support or upgrade DKMS to a more current version."
99 exit 1
100
101 %preun
102 dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
103 exit 0
104
105 %changelog
106 * Sat Jan 23 2016 Bruno Faccini <bruno.faccini@intel.com>
107  - detect and handle cases where [spl,zfs]-dkms packages are not built
108  - also handle on-target configure issues
109 * Wed Oct  7 2015 Bruno Faccini <bruno.faccini@intel.com>
110  - adapted for Lustre Client DKMS creation
111  - allow for on-target reconfig to prevent static deps requires
112 * Mon Apr  8 2013 Brian Behlendorf <behlendorf1@llnl.gov> - 2.3.63-1
113 - First DKMS packages.