]>
Commit | Line | Data |
---|---|---|
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 |
20 | Name: %{module}-dkms |
21 | ||
22 | Version: @VERSION@ | |
23 | Release: @RELEASE@%{?dist} | |
24 | Summary: Kernel module(s) (dkms) | |
25 | ||
26 | Group: System Environment/Kernel | |
27 | License: GPLv2+ | |
28 | URL: http://zfsonlinux.org/ | |
29 | Source0: %{module}-%{version}.tar.gz | |
30 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | |
31 | BuildArch: noarch | |
32 | ||
33 | Requires: dkms >= 2.2.0.2 | |
80093b6f | 34 | Requires: gcc, make, perl |
4a691129 | 35 | %if 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version} |
80093b6f | 36 | Requires: kernel-devel |
4a691129 | 37 | %endif |
493972c8 | 38 | Provides: %{module}-kmod = %{version} |
493972c8 BB |
39 | |
40 | %description | |
41 | This package contains the dkms kernel modules required to emulate | |
42 | several 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 | |
51 | if [ "$RPM_BUILD_ROOT" != "/" ]; then | |
52 | rm -rf $RPM_BUILD_ROOT | |
53 | fi | |
54 | mkdir -p $RPM_BUILD_ROOT/usr/src/ | |
55 | cp -rf ${RPM_BUILD_DIR}/%{module}-%{version} $RPM_BUILD_ROOT/usr/src/ | |
56 | ||
57 | %clean | |
58 | if [ "$RPM_BUILD_ROOT" != "/" ]; then | |
59 | rm -rf $RPM_BUILD_ROOT | |
60 | fi | |
61 | ||
62 | %files | |
63 | %defattr(-,root,root) | |
64 | /usr/src/%{module}-%{version} | |
65 | ||
66 | %post | |
67 | for 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." | |
73 | done | |
74 | echo -e "ERROR: DKMS version is too old and %{module} was not" | |
75 | echo -e "built with legacy DKMS support." | |
76 | echo -e "You must either rebuild %{module} with legacy postinst" | |
77 | echo -e "support or upgrade DKMS to a more current version." | |
78 | exit 1 | |
79 | ||
80 | %preun | |
ec06701b AX |
81 | CONFIG_H="/var/lib/dkms/%{module}/%{version}/*/*/%{module}_config.h" |
82 | SPEC_META_ALIAS="@PACKAGE@-@VERSION@-@RELEASE@" | |
83 | DKMS_META_ALIAS=`cat $CONFIG_H 2>/dev/null | | |
84 | awk -F'"' '/META_ALIAS/ { print $2; exit 0 }'` | |
85 | if [ "$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 | 89 | fi |
493972c8 BB |
90 | exit 0 |
91 | ||
92 | %changelog | |
9e4fb5c2 LG |
93 | * %(date "+%a %b %d %Y") %packager %{version}-%{release} |
94 | - Automatic build by DKMS |