File zfs-dkms.spec of Package zfs

# spec file for package zfs-dkms
# Copyright (c) 2017 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

%define pkg_name zfs

# Disable build root compress policy
%define __spec_install_post %{nil}

Name:           %{pkg_name}-dkms
Version:        0.7.0
Release:        rc4
Summary:        Kernel module(s) (dkms)
License:        CDDL-1.0
Group:          System/Base
Source1:        %{name}.conf
Source2:        %{name}-rpmlintrc
Patch0:         %{name}.patch
Requires:       autoconf
Requires:       automake
Requires:       dkms >=
Requires:       gcc
Requires:       libtool
Requires:       make
Requires:       spl-dkms = %{version}
Provides:       %{pkg_name}-kmp = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

This package contains the dkms ZFS kernel modules.

%setup -q -n %{pkg_name}-%{pkg_name}-%{version}
%patch0 -p1

./scripts/dkms.mkconf -n %{pkg_name} -v %{version} -f dkms.conf

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}

%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}
exit 0

# modprobe can fail
if [ -x /sbin/modprobe ] ; then
    /sbin/modprobe -r %{pkg_name} zavl znvpair zunicode zcommon zpios >/dev/null 2>&1
set -x
if [ -x %{_sbindir}/dkms ] ; then
    %{_sbindir}/dkms remove -m %{pkg_name} -v %{version} --all --rpm_safe_upgrade || :
exit 0

%config(noreplace) %{_localstatedir}/adm/fillup-templates/sysconfig.%{pkg_name}