]> git.proxmox.com Git - mirror_spl-debian.git/blame - rpm/generic/spl-dkms.spec.in
New upstream version 0.7.9
[mirror_spl-debian.git] / rpm / generic / spl-dkms.spec.in
CommitLineData
9e4fb5c2
LG
1%{?!packager: %define packager Brian Behlendorf <behlendorf1@llnl.gov>}
2
4a691129
AX
3%if ! 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
4%define not_rpm 1
5%endif
6
493972c8
BB
7%define module @PACKAGE@
8%define mkconf scripts/dkms.mkconf
9
74894160
AX
10# Python permits the !/usr/bin/python shebang for scripts that are cross
11# compatible between python2 and python3, but Fedora 28 does not. Fedora
12# wants us to choose python3 for cross-compatible scripts. Since we want
13# to support python2 and python3 users, exclude our scripts from Fedora 28's
14# RPM build check, so that we don't get a bunch of build warnings.
15#
16# Details: https://github.com/zfsonlinux/zfs/issues/7360
17#
18%global __brp_mangle_shebangs_exclude_from splslab.py
19
493972c8
BB
20Name: %{module}-dkms
21
22Version: @VERSION@
23Release: @RELEASE@%{?dist}
24Summary: Kernel module(s) (dkms)
25
26Group: System Environment/Kernel
27License: GPLv2+
28URL: http://zfsonlinux.org/
29Source0: %{module}-%{version}.tar.gz
30BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
31BuildArch: noarch
32
33Requires: dkms >= 2.2.0.2
80093b6f 34Requires: gcc, make, perl
4a691129 35%if 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
80093b6f 36Requires: kernel-devel
4a691129 37%endif
493972c8 38Provides: %{module}-kmod = %{version}
493972c8
BB
39
40%description
41This package contains the dkms kernel modules required to emulate
42several interfaces provided by the Solaris kernel.
43
44%prep
45%setup -q -n %{module}-%{version}
46
47%build
48%{mkconf} -n %{module} -v %{version} -f dkms.conf
49
50%install
51if [ "$RPM_BUILD_ROOT" != "/" ]; then
52 rm -rf $RPM_BUILD_ROOT
53fi
54mkdir -p $RPM_BUILD_ROOT/usr/src/
55cp -rf ${RPM_BUILD_DIR}/%{module}-%{version} $RPM_BUILD_ROOT/usr/src/
56
57%clean
58if [ "$RPM_BUILD_ROOT" != "/" ]; then
59 rm -rf $RPM_BUILD_ROOT
60fi
61
62%files
63%defattr(-,root,root)
64/usr/src/%{module}-%{version}
65
66%post
67for POSTINST in /usr/lib/dkms/common.postinst; do
68 if [ -f $POSTINST ]; then
69 $POSTINST %{module} %{version}
70 exit $?
71 fi
72 echo "WARNING: $POSTINST does not exist."
73done
74echo -e "ERROR: DKMS version is too old and %{module} was not"
75echo -e "built with legacy DKMS support."
76echo -e "You must either rebuild %{module} with legacy postinst"
77echo -e "support or upgrade DKMS to a more current version."
78exit 1
79
80%preun
ec06701b
AX
81CONFIG_H="/var/lib/dkms/%{module}/%{version}/*/*/%{module}_config.h"
82SPEC_META_ALIAS="@PACKAGE@-@VERSION@-@RELEASE@"
83DKMS_META_ALIAS=`cat $CONFIG_H 2>/dev/null |
84 awk -F'"' '/META_ALIAS/ { print $2; exit 0 }'`
85if [ "$SPEC_META_ALIAS" = "$DKMS_META_ALIAS" ]; then
86 echo -e
87 echo -e "Uninstall of %{module} module ($SPEC_META_ALIAS) beginning:"
4a691129 88 dkms remove -m %{module} -v %{version} --all %{!?not_rpm:--rpm_safe_upgrade}
ec06701b 89fi
493972c8
BB
90exit 0
91
92%changelog
9e4fb5c2
LG
93* %(date "+%a %b %d %Y") %packager %{version}-%{release}
94- Automatic build by DKMS