Fix checkstyle warning
[zfs.git] / rpm / generic / zfs-dkms.spec.in
blob23c3ed6ff408dedd779ee8fca2beb94d2e3a8fcb
1 %{?!packager: %define packager Brian Behlendorf <behlendorf1@llnl.gov>}
3 %if ! 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}%{?openEuler}
4 %define not_rpm 1
5 %endif
7 # Exclude input files from mangling
8 %global __brp_mangle_shebangs_exclude_from ^/usr/src/.*$
10 %define module @PACKAGE@
11 %define mkconf scripts/dkms.mkconf
13 Name: %{module}-dkms
15 Version: @VERSION@
16 Release: @RELEASE@%{?dist}
17 Summary: Kernel module(s) (dkms)
19 Group: System Environment/Kernel
20 License: @ZFS_META_LICENSE@
21 URL: https://github.com/openzfs/zfs
22 Source0: %{module}-%{version}.tar.gz
23 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
24 BuildArch: noarch
26 Requires: dkms >= 2.2.0.3
27 Requires(post): dkms >= 2.2.0.3
28 Requires(preun): dkms >= 2.2.0.3
29 Requires: gcc, make, perl, diffutils
30 Requires(post): gcc, make, perl, diffutils
31 %if 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}%{?openEuler}
32 Requires: kernel-devel >= @ZFS_META_KVER_MIN@, kernel-devel <= @ZFS_META_KVER_MAX@.999
33 Requires(post): kernel-devel >= @ZFS_META_KVER_MIN@, kernel-devel <= @ZFS_META_KVER_MAX@.999
34 Obsoletes: spl-dkms <= %{version}
35 %endif
36 Provides: %{module}-kmod = %{version}
37 AutoReqProv: no
39 %if (0%{?fedora}%{?suse_version}%{?openEuler}) || (0%{?rhel} && 0%{?rhel} < 9)
40 # We don't directly use it, but if this isn't installed, rpmbuild as root can
41 # crash+corrupt rpmdb
42 # See issue #12071
43 BuildRequires: ncompress
44 %endif
46 %description
47 This package contains the dkms ZFS kernel modules.
49 %prep
50 %setup -q -n %{module}-%{version}
52 %build
53 %{mkconf} -n %{module} -v %{version} -f dkms.conf
55 %install
56 if [ "$RPM_BUILD_ROOT" != "/" ]; then
57 rm -rf $RPM_BUILD_ROOT
59 mkdir -p $RPM_BUILD_ROOT/usr/src/
60 cp -rf ${RPM_BUILD_DIR}/%{module}-%{version} $RPM_BUILD_ROOT/usr/src/
62 %clean
63 if [ "$RPM_BUILD_ROOT" != "/" ]; then
64 rm -rf $RPM_BUILD_ROOT
67 %files
68 %defattr(-,root,root)
69 /usr/src/%{module}-%{version}
71 %preun
72 dkms remove -m %{module} -v %{version} --all
74 %posttrans
75 /usr/lib/dkms/common.postinst %{module} %{version}