File zfs-dkms.spec of Package zfs
#
# spec file for package zfs-dkms
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define pkg_name zfs
# Disable build root compress policy
%define __spec_install_post %{nil}
Name: %{pkg_name}-dkms
Version: 0.6.5.3
Release: 0
Summary: Kernel module(s) (dkms)
License: CDDL-1.0
Group: System/Base
Url: http://zfsonlinux.org/
Source0: https://github.com/zfsonlinux/zfs/archive/%{pkg_name}-%{version}.tar.gz
Source1: %{name}.conf
Patch0: %{name}.patch
Requires: autoconf
Requires: automake
Requires: dkms >= 2.2.0.3
Requires: gcc
Requires: libtool
Requires: make
Requires: spl-dkms = %{version}
Provides: %{pkg_name}-kmp = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
This package contains the dkms ZFS kernel modules.
%prep
%setup -q -n %{pkg_name}-%{pkg_name}-%{version}
%patch0 -p1
%build
./scripts/dkms.mkconf -n %{pkg_name} -v %{version} -f dkms.conf
%install
mkdir -p %{buildroot}%{_usrsrc}
cp -rf %{_builddir}/%{pkg_name}-%{pkg_name}-%{version} %{buildroot}%{_usrsrc}/%{pkg_name}-%{version}
find %{buildroot}%{_usrsrc}/%{pkg_name}-%{version} -name "*.orig" -exec rm -f {} \;
find %{buildroot}%{_usrsrc}/%{pkg_name}-%{version} -name ".gitignore" -exec rm -f {} \;
install -D -m 0644 %{SOURCE1} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{pkg_name}
%post
%fillup_only -n %{pkg_name}
set -x
if [ -x %{_sbindir}/dkms ] ; then
%{_sbindir}/dkms add -m %{pkg_name} -v %{version} --rpm_safe_upgrade
%{_sbindir}/dkms build -m %{pkg_name} -v %{version}
%{_sbindir}/dkms install -m %{pkg_name} -v %{version}
fi
exit 0
%preun
# modprobe can fail
if [ -x /sbin/modprobe ] ; then
/sbin/modprobe -r %{pkg_name} zavl znvpair zunicode zcommon zpios >/dev/null 2>&1
fi
set -x
if [ -x %{_sbindir}/dkms ] ; then
%{_sbindir}/dkms remove -m %{pkg_name} -v %{version} --all --rpm_safe_upgrade || :
fi
exit 0
%files
%defattr(-,root,root)
%{_usrsrc}/%{pkg_name}-*
%config(noreplace) %{_localstatedir}/adm/fillup-templates/sysconfig.%{pkg_name}
%changelog