Blame SPECS/kmod-mptsas.spec

8c3bf2
%global pkg mptsas
8c3bf2
8c3bf2
%global kernel_version_min 4.18.0-80.el8
8c3bf2
8c3bf2
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
8c3bf2
# Otherwise the latest installed kernel-devel version later than
8c3bf2
# %%{kernel_version_min} will be used.
8c3bf2
8c3bf2
%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)
8c3bf2
8c3bf2
%if "%{kernel_version_latest}" != ""
8c3bf2
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
8c3bf2
%endif
8c3bf2
8c3bf2
%global _use_internal_dependency_generator 0
8c3bf2
%global __find_requires %{nil}
8c3bf2
%global __find_provides /usr/lib/rpm/find-provides
8c3bf2
8c3bf2
%global debug_package %{nil}
8c3bf2
8c3bf2
%global __spec_install_post \
8c3bf2
  %{?__debug_package:%{__debug_install_post}} \
8c3bf2
  %{__arch_install_post} \
8c3bf2
  %{__os_install_post} \
8c3bf2
  %{__mod_compress_install_post}
8c3bf2
8c3bf2
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
8c3bf2
8c3bf2
8c3bf2
Name:             kmod-%{pkg}
8c3bf2
Version:          4.18.0
78a4c5
Release:          305.12.1%{?dist}
8c3bf2
Summary:          Fusion MPT SAS Host (%{pkg}) driver
8c3bf2
8c3bf2
License:          GPLv2
8c3bf2
URL:              https://www.kernel.org/
8c3bf2
8c3bf2
Source0:          %{pkg}-%{kernel_version_min}.tar.xz
8c3bf2
Patch1:           0001-add-deprecated-ids.patch
8c3bf2
8c3bf2
ExclusiveArch:    x86_64 aarch64
8c3bf2
8c3bf2
BuildRequires:    elfutils-libelf-devel
8c3bf2
BuildRequires:    gcc
8c3bf2
BuildRequires:    kmod
8c3bf2
BuildRequires:    make
8c3bf2
BuildRequires:    redhat-rpm-config
8c3bf2
BuildRequires:    xz
8c3bf2
8c3bf2
%{!?kernel_version:
8c3bf2
BuildRequires:    kernel-devel >= %{kernel_version_min}
8c3bf2
}
8c3bf2
8c3bf2
%{?kernel_version:
8c3bf2
BuildRequires:    kernel-devel = %{kernel_version}
8c3bf2
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
8c3bf2
8c3bf2
Requires:         kernel-core = %{kernel_version}
8c3bf2
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
8c3bf2
Requires:         kernel-modules = %{kernel_version}
8c3bf2
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
8c3bf2
8c3bf2
Provides:         installonlypkg(kernel-module)
8c3bf2
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
8c3bf2
}
8c3bf2
8c3bf2
Requires(post):   /usr/sbin/depmod
8c3bf2
Requires(postun): /usr/sbin/depmod
8c3bf2
8c3bf2
Requires(post):   /usr/bin/dracut
8c3bf2
Requires(postun): /usr/bin/dracut
8c3bf2
8c3bf2
8c3bf2
%description
8c3bf2
This package provides the Fusion MPT SAS Host (%{pkg}) driver.  Compared to the
8c3bf2
in-kernel driver this driver is not restricted to the virtualization use case.
8c3bf2
It supports the following adapters:
8c3bf2
8c3bf2
- 0x1000:0x0050: LSI SAS1064
8c3bf2
- 0x1000:0x0054: LSI SAS1068
8c3bf2
- 0x1000:0x0056: LSI SAS1064E
8c3bf2
- 0x1000:0x0058: LSI SAS1068E
8c3bf2
- 0x1000:0x0059: LSI SAS1068_820XELP
8c3bf2
- 0x1000:0x0062: LSI SAS1078
8c3bf2
8c3bf2
8c3bf2
%prep
8c3bf2
%autosetup -p1 -n %{pkg}-%{kernel_version_min}
8c3bf2
8c3bf2
8c3bf2
%build
8c3bf2
pushd src
8c3bf2
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
8c3bf2
popd
8c3bf2
8c3bf2
8c3bf2
%install
8c3bf2
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/message/fusion src/%{pkg}.ko
8c3bf2
8c3bf2
# Make .ko objects temporarily executable for automatic stripping
8c3bf2
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
8c3bf2
8c3bf2
8c3bf2
%clean
8c3bf2
%{__rm} -rf %{buildroot}
8c3bf2
8c3bf2
8c3bf2
%post
8c3bf2
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
8c3bf2
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
8c3bf2
8c3bf2
8c3bf2
%preun
8c3bf2
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
8c3bf2
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
8c3bf2
8c3bf2
8c3bf2
%postun
8c3bf2
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
8c3bf2
then
8c3bf2
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
8c3bf2
    then
8c3bf2
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
8c3bf2
    fi
8c3bf2
8c3bf2
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
8c3bf2
    then
8c3bf2
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
8c3bf2
        then
8c3bf2
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
8c3bf2
            then
8c3bf2
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
8c3bf2
            else
8c3bf2
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
8c3bf2
            fi
8c3bf2
        fi
8c3bf2
    fi
8c3bf2
8c3bf2
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
8c3bf2
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
8c3bf2
fi
8c3bf2
8c3bf2
8c3bf2
%posttrans
8c3bf2
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
8c3bf2
then
8c3bf2
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
8c3bf2
    then
8c3bf2
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
8c3bf2
    fi
8c3bf2
8c3bf2
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
8c3bf2
    then
8c3bf2
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
8c3bf2
        then
8c3bf2
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
8c3bf2
            then
8c3bf2
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
8c3bf2
            else
8c3bf2
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
8c3bf2
            fi
8c3bf2
        fi
8c3bf2
    fi
8c3bf2
8c3bf2
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
8c3bf2
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
8c3bf2
fi
8c3bf2
8c3bf2
8c3bf2
%files
8c3bf2
%defattr(644,root,root,755)
8c3bf2
/lib/modules/%{kernel_version}.%{_arch}
8c3bf2
%license COPYING
8c3bf2
8c3bf2
8c3bf2
%changelog
78a4c5
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305.12.1
78a4c5
- Rebuild for 4.18.0-305.12.1.el8_4
78a4c5
8c3bf2
* Wed Aug 11 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 4.18.0-305
8c3bf2
- Initial version