aboutsummaryrefslogtreecommitdiffstats
path: root/rpm/generic/zfs-dkms.spec.in
blob: cd0a3ded2a000ef9d0c5a4c2e696c5bbb400c28c (plain)
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
%{?!packager: %define packager Brian Behlendorf <behlendorf1@llnl.gov>}

%if ! 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
%define not_rpm 1
%endif

# Exclude input files from mangling
%global __brp_mangle_shebangs_exclude_from ^/usr/src/.*$

%define module  @PACKAGE@
%define mkconf  scripts/dkms.mkconf

Name:           %{module}-dkms

Version:        @VERSION@
Release:        @RELEASE@%{?dist}
Summary:        Kernel module(s) (dkms)

Group:          System Environment/Kernel
License:        @ZFS_META_LICENSE@
URL:            https://github.com/openzfs/zfs
Source0:        %{module}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch

Requires:       dkms >= 2.2.0.3
Requires(post): dkms >= 2.2.0.3
Requires(preun): dkms >= 2.2.0.3
Requires:       gcc, make, perl, diffutils
Requires(post): gcc, make, perl, diffutils
%if 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
Requires:       kernel-devel >= @ZFS_META_KVER_MIN@, kernel-devel <= @ZFS_META_KVER_MAX@.999
Requires(post): kernel-devel >= @ZFS_META_KVER_MIN@, kernel-devel <= @ZFS_META_KVER_MAX@.999
Obsoletes:      spl-dkms
%endif
Provides:       %{module}-kmod = %{version}
AutoReqProv:    no

%if 0%{?rhel}%{?fedora}%{?suse_version}
# We don't directly use it, but if this isn't installed, rpmbuild as root can
# crash+corrupt rpmdb
# See issue #12071
BuildRequires:  ncompress
%endif

%description
This package contains the dkms ZFS kernel modules.

%prep
%setup -q -n %{module}-%{version}

%build
%{mkconf} -n %{module} -v %{version} -f dkms.conf

%install
if [ "$RPM_BUILD_ROOT" != "/" ]; then
    rm -rf $RPM_BUILD_ROOT
fi
mkdir -p $RPM_BUILD_ROOT/usr/src/
cp -rf ${RPM_BUILD_DIR}/%{module}-%{version} $RPM_BUILD_ROOT/usr/src/

%clean
if [ "$RPM_BUILD_ROOT" != "/" ]; then
    rm -rf $RPM_BUILD_ROOT
fi

%files
%defattr(-,root,root)
/usr/src/%{module}-%{version}

%preun
dkms remove -m %{module} -v %{version} --all

%posttrans
/usr/lib/dkms/common.postinst %{module} %{version}