summaryrefslogtreecommitdiffstats
path: root/rpm/generic/zfs-dkms.spec.in
diff options
context:
space:
mode:
Diffstat (limited to 'rpm/generic/zfs-dkms.spec.in')
-rw-r--r--rpm/generic/zfs-dkms.spec.in67
1 files changed, 67 insertions, 0 deletions
diff --git a/rpm/generic/zfs-dkms.spec.in b/rpm/generic/zfs-dkms.spec.in
new file mode 100644
index 000000000..3713b1a90
--- /dev/null
+++ b/rpm/generic/zfs-dkms.spec.in
@@ -0,0 +1,67 @@
+%define module @PACKAGE@
+%define mkconf scripts/dkms.mkconf
+
+Name: %{module}-dkms
+
+Version: @VERSION@
+Release: @RELEASE@%{?dist}
+Summary: Kernel module(s) (dkms)
+
+Group: System Environment/Kernel
+License: @ZFS_META_LICENSE@
+URL: http://zfsonlinux.org/
+Source0: %{module}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+
+Requires: dkms >= 2.2.0.2
+Provides: %{module}-kmod = %{version}
+Conflicts: %{module}-kmod
+
+%description
+This package contains the dkms ZFS kernel modules.
+
+%prep
+%setup -q -n %{module}-%{version}
+
+%build
+%{mkconf} -n %{module} -v %{version} -f dkms.conf
+
+%install
+if [ "$RPM_BUILD_ROOT" != "/" ]; then
+ rm -rf $RPM_BUILD_ROOT
+fi
+mkdir -p $RPM_BUILD_ROOT/usr/src/
+cp -rf ${RPM_BUILD_DIR}/%{module}-%{version} $RPM_BUILD_ROOT/usr/src/
+
+%clean
+if [ "$RPM_BUILD_ROOT" != "/" ]; then
+ rm -rf $RPM_BUILD_ROOT
+fi
+
+%files
+%defattr(-,root,root)
+/usr/src/%{module}-%{version}
+
+%post
+for POSTINST in /usr/lib/dkms/common.postinst; do
+ if [ -f $POSTINST ]; then
+ $POSTINST %{module} %{version}
+ exit $?
+ fi
+ echo "WARNING: $POSTINST does not exist."
+done
+echo -e "ERROR: DKMS version is too old and %{module} was not"
+echo -e "built with legacy DKMS support."
+echo -e "You must either rebuild %{module} with legacy postinst"
+echo -e "support or upgrade DKMS to a more current version."
+exit 1
+
+%preun
+dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
+exit 0
+
+%changelog
+* Tue Mar 12 2013 Brian Behlendorf <[email protected]> - 0.6.0-1
+- Initial dkms packaging.
+