]> git.proxmox.com Git - mirror_zfs-debian.git/blob - rpm/redhat/zfs-dkms.spec.in
New upstream version 0.7.11
[mirror_zfs-debian.git] / rpm / redhat / zfs-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: @ZFS_META_LICENSE@
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.3
24 Requires: spl-dkms = %{version}
25 Requires: gcc, make, perl
26 %if 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
27 Requires: kernel-devel
28 %endif
29 Provides: %{module}-kmod = %{version}
30 AutoReqProv: no
31
32 %description
33 This package contains the dkms ZFS kernel modules.
34
35 %prep
36 %setup -q -n %{module}-%{version}
37
38 %build
39 %{mkconf} -n %{module} -v %{version} -f dkms.conf
40
41 %install
42 if [ "$RPM_BUILD_ROOT" != "/" ]; then
43 rm -rf $RPM_BUILD_ROOT
44 fi
45 mkdir -p $RPM_BUILD_ROOT/usr/src/
46 cp -rf ${RPM_BUILD_DIR}/%{module}-%{version} $RPM_BUILD_ROOT/usr/src/
47
48 %clean
49 if [ "$RPM_BUILD_ROOT" != "/" ]; then
50 rm -rf $RPM_BUILD_ROOT
51 fi
52
53 %files
54 %defattr(-,root,root)
55 /usr/src/%{module}-%{version}
56
57 %post
58 for POSTINST in /usr/lib/dkms/common.postinst; do
59 if [ -f $POSTINST ]; then
60 $POSTINST %{module} %{version}
61 exit $?
62 fi
63 echo "WARNING: $POSTINST does not exist."
64 done
65 echo -e "ERROR: DKMS version is too old and %{module} was not"
66 echo -e "built with legacy DKMS support."
67 echo -e "You must either rebuild %{module} with legacy postinst"
68 echo -e "support or upgrade DKMS to a more current version."
69 exit 1
70
71 %preun
72 CONFIG_H="/var/lib/dkms/%{module}/%{version}/*/*/%{module}_config.h"
73 SPEC_META_ALIAS="@PACKAGE@-@VERSION@-@RELEASE@"
74 DKMS_META_ALIAS=`cat $CONFIG_H 2>/dev/null |
75 awk -F'"' '/META_ALIAS/ { print $2; exit 0 }'`
76 if [ "$SPEC_META_ALIAS" = "$DKMS_META_ALIAS" ]; then
77 echo -e
78 echo -e "Uninstall of %{module} module ($SPEC_META_ALIAS) beginning:"
79 dkms remove -m %{module} -v %{version} --all %{!?not_rpm:--rpm_safe_upgrade}
80 fi
81 exit 0
82
83 %changelog
84 * %(date "+%a %b %d %Y") %packager %{version}-%{release}
85 - Automatic build by DKMS