]> git.proxmox.com Git - mirror_spl.git/blob - rpm/generic/spl-dkms.spec.in
Exclude python scripts from RPM shebang check
[mirror_spl.git] / rpm / generic / spl-dkms.spec.in
1 %{?!packager: %define packager Brian Behlendorf <behlendorf1@llnl.gov>}
2
3 %if ! 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
4 %define not_rpm 1
5 %endif
6
7 %define module @PACKAGE@
8 %define mkconf scripts/dkms.mkconf
9
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
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
34 Requires: gcc, make, perl
35 %if 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
36 Requires: kernel-devel
37 %endif
38 Provides: %{module}-kmod = %{version}
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
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:"
88 dkms remove -m %{module} -v %{version} --all %{!?not_rpm:--rpm_safe_upgrade}
89 fi
90 exit 0
91
92 %changelog
93 * %(date "+%a %b %d %Y") %packager %{version}-%{release}
94 - Automatic build by DKMS