Blame SPECS/kmod-mpt3sas.spec

f96abd
%global pkg mpt3sas
f96abd
f96abd
%global kernel_version_min 4.18.0-305.el8
f96abd
f96abd
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
f96abd
# Otherwise the latest installed kernel-devel version later than
f96abd
# %%{kernel_version_min} will be used.
f96abd
f96abd
%global kernel_version_latest %({ echo %{kernel_version_min}; rpm --query kernel-devel --queryformat '%%{VERSION}-%%{RELEASE}\\\n' | grep -v "package kernel-devel is not installed"; } | sort -V | sed -e '0,/^%{kernel_version_min}$/d' | tail -n 1)
f96abd
f96abd
%if "%{kernel_version_latest}" != ""
f96abd
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
f96abd
%endif
f96abd
f96abd
%global _use_internal_dependency_generator 0
f96abd
%global __find_requires %{nil}
f96abd
%global __find_provides /usr/lib/rpm/find-provides
f96abd
f96abd
%global debug_package %{nil}
f96abd
f96abd
%global __spec_install_post \
f96abd
  %{?__debug_package:%{__debug_install_post}} \
f96abd
  %{__arch_install_post} \
f96abd
  %{__os_install_post} \
f96abd
  %{__mod_compress_install_post}
f96abd
f96abd
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
f96abd
f96abd
f96abd
Name:             kmod-%{pkg}
f96abd
Version:          4.18.0
f96abd
Release:          305%{?dist}
f96abd
Summary:          LSI MPT Fusion SAS 3.0 Device (%{pkg}) driver
f96abd
f96abd
License:          GPLv2
f96abd
URL:              https://www.kernel.org/
f96abd
f96abd
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
f96abd
Patch1:           0001-add-deprecated-ids.patch
f96abd
f96abd
ExclusiveArch:    x86_64 aarch64
f96abd
f96abd
BuildRequires:    elfutils-libelf-devel
f96abd
BuildRequires:    gcc
f96abd
BuildRequires:    kmod
f96abd
BuildRequires:    make
f96abd
BuildRequires:    redhat-rpm-config
f96abd
BuildRequires:    xz
f96abd
f96abd
%{!?kernel_version:
f96abd
BuildRequires:    kernel-devel >= %{kernel_version_min}
f96abd
}
f96abd
f96abd
%{?kernel_version:
f96abd
BuildRequires:    kernel-devel = %{kernel_version}
f96abd
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
f96abd
f96abd
Requires:         kernel-core = %{kernel_version}
f96abd
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
f96abd
Requires:         kernel-modules = %{kernel_version}
f96abd
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
f96abd
f96abd
Provides:         installonlypkg(kernel-module)
f96abd
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
f96abd
}
f96abd
f96abd
Requires(post):   /usr/sbin/depmod
f96abd
Requires(postun): /usr/sbin/depmod
f96abd
f96abd
Requires(post):   /usr/bin/dracut
f96abd
Requires(postun): /usr/bin/dracut
f96abd
f96abd
f96abd
%description
f96abd
This package provides the LSI MPT Fusion SAS 3.0 Device (%{pkg}) driver.
f96abd
Compared to the in-kernel driver this driver re-enables support for deprecated
f96abd
mpt2sas adapters:
f96abd
f96abd
- 0x1000:0x0064: LSI SAS2116_1
f96abd
- 0x1000:0x0065: LSI SAS2116_2
f96abd
- 0x1000:0x0070: LSI SAS2004
f96abd
- 0x1000:0x0072: LSI SAS2008
f96abd
- 0x1000:0x0074: LSI SAS2108_1
f96abd
- 0x1000:0x0076: LSI SAS2108_2
f96abd
- 0x1000:0x0077: LSI SAS2108_3
f96abd
- 0x1000:0x007E: LSI SSS6200
f96abd
f96abd
f96abd
%prep
f96abd
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
f96abd
f96abd
f96abd
%build
f96abd
pushd src
f96abd
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
f96abd
popd
f96abd
f96abd
f96abd
%install
f96abd
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/%{pkg} src/%{pkg}.ko
f96abd
f96abd
# Make .ko objects temporarily executable for automatic stripping
f96abd
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
f96abd
f96abd
f96abd
%clean
f96abd
%{__rm} -rf %{buildroot}
f96abd
f96abd
f96abd
%post
f96abd
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
f96abd
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
f96abd
f96abd
f96abd
%preun
f96abd
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
f96abd
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
f96abd
f96abd
f96abd
%postun
f96abd
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
f96abd
then
f96abd
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
f96abd
    then
f96abd
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
f96abd
    fi
f96abd
f96abd
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
f96abd
    then
f96abd
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
f96abd
        then
f96abd
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
f96abd
            then
f96abd
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
f96abd
            else
f96abd
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
f96abd
            fi
f96abd
        fi
f96abd
    fi
f96abd
f96abd
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
f96abd
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
f96abd
fi
f96abd
f96abd
f96abd
%posttrans
f96abd
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
f96abd
then
f96abd
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
f96abd
    then
f96abd
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
f96abd
    fi
f96abd
f96abd
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
f96abd
    then
f96abd
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
f96abd
        then
f96abd
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
f96abd
            then
f96abd
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
f96abd
            else
f96abd
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
f96abd
            fi
f96abd
        fi
f96abd
    fi
f96abd
f96abd
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
f96abd
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
f96abd
fi
f96abd
f96abd
f96abd
%files
f96abd
%defattr(644,root,root,755)
f96abd
/lib/modules/%{kernel_version}.%{_arch}
f96abd
%license COPYING
f96abd
f96abd
f96abd
%changelog
f96abd
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305
f96abd
- Initial version