]> git.proxmox.com Git - mirror_spl.git/blob - rpm/generic/spl-dkms.spec.in
Add DKMS package on Debian-based distributions
[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 Name: %{module}-dkms
11
12 Version: @VERSION@
13 Release: @RELEASE@%{?dist}
14 Summary: Kernel module(s) (dkms)
15
16 Group: System Environment/Kernel
17 License: GPLv2+
18 URL: http://zfsonlinux.org/
19 Source0: %{module}-%{version}.tar.gz
20 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
21 BuildArch: noarch
22
23 Requires: dkms >= 2.2.0.2
24 Requires: gcc, make, perl
25 %if 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
26 Requires: kernel-devel
27 %endif
28 Provides: %{module}-kmod = %{version}
29
30 %description
31 This package contains the dkms kernel modules required to emulate
32 several interfaces provided by the Solaris kernel.
33
34 %prep
35 %setup -q -n %{module}-%{version}
36
37 %build
38 %{mkconf} -n %{module} -v %{version} -f dkms.conf
39
40 %install
41 if [ "$RPM_BUILD_ROOT" != "/" ]; then
42 rm -rf $RPM_BUILD_ROOT
43 fi
44 mkdir -p $RPM_BUILD_ROOT/usr/src/
45 cp -rf ${RPM_BUILD_DIR}/%{module}-%{version} $RPM_BUILD_ROOT/usr/src/
46
47 %clean
48 if [ "$RPM_BUILD_ROOT" != "/" ]; then
49 rm -rf $RPM_BUILD_ROOT
50 fi
51
52 %files
53 %defattr(-,root,root)
54 /usr/src/%{module}-%{version}
55
56 %post
57 for POSTINST in /usr/lib/dkms/common.postinst; do
58 if [ -f $POSTINST ]; then
59 $POSTINST %{module} %{version}
60 exit $?
61 fi
62 echo "WARNING: $POSTINST does not exist."
63 done
64 echo -e "ERROR: DKMS version is too old and %{module} was not"
65 echo -e "built with legacy DKMS support."
66 echo -e "You must either rebuild %{module} with legacy postinst"
67 echo -e "support or upgrade DKMS to a more current version."
68 exit 1
69
70 %preun
71 CONFIG_H="/var/lib/dkms/%{module}/%{version}/*/*/%{module}_config.h"
72 SPEC_META_ALIAS="@PACKAGE@-@VERSION@-@RELEASE@"
73 DKMS_META_ALIAS=`cat $CONFIG_H 2>/dev/null |
74 awk -F'"' '/META_ALIAS/ { print $2; exit 0 }'`
75 if [ "$SPEC_META_ALIAS" = "$DKMS_META_ALIAS" ]; then
76 echo -e
77 echo -e "Uninstall of %{module} module ($SPEC_META_ALIAS) beginning:"
78 dkms remove -m %{module} -v %{version} --all %{!?not_rpm:--rpm_safe_upgrade}
79 fi
80 exit 0
81
82 %changelog
83 * %(date "+%a %b %d %Y") %packager %{version}-%{release}
84 - Automatic build by DKMS