Blame SPECS/kmod-mpt3sas.spec

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