Blame SPECS/kmod-megaraid_sas.spec

7ecbca
%global pkg megaraid_sas
7ecbca
7ecbca
%global driver_version 5.14.0-1.el9
7ecbca
7ecbca
%global kernel_version 5.14.0-1.el9
7ecbca
7ecbca
%global _use_internal_dependency_generator 0
7ecbca
%global __find_requires %{nil}
7ecbca
%global __find_provides /usr/lib/rpm/find-provides
7ecbca
7ecbca
%global debug_package %{nil}
7ecbca
7ecbca
%global __spec_install_post \
7ecbca
  %{?__debug_package:%{__debug_install_post}} \
7ecbca
  %{__arch_install_post} \
7ecbca
  %{__os_install_post} \
7ecbca
  %{__mod_compress_install_post}
7ecbca
7ecbca
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
7ecbca
7ecbca
7ecbca
Name:             kmod-%{pkg}
7ecbca
Version:          5.14.0
7ecbca
Release:          1%{?dist}
7ecbca
Summary:          Broadcom MegaRAID SAS (%{pkg}) driver
7ecbca
7ecbca
License:          GPLv2
7ecbca
URL:              https://www.kernel.org/
7ecbca
7ecbca
Source0:          %{pkg}-%{driver_version}.tar.xz
7ecbca
Patch1:           0001-add-deprecated-ids.patch
7ecbca
7ecbca
ExclusiveArch:    x86_64 aarch64
7ecbca
7ecbca
BuildRequires:    elfutils-libelf-devel
7ecbca
BuildRequires:    gcc
7ecbca
BuildRequires:    kmod
7ecbca
BuildRequires:    make
7ecbca
BuildRequires:    redhat-rpm-config
7ecbca
BuildRequires:    xz
7ecbca
7ecbca
BuildRequires:    kernel-devel = %{kernel_version}
7ecbca
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
7ecbca
7ecbca
Requires:         kernel-core = %{kernel_version}
7ecbca
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
7ecbca
Requires:         kernel-modules = %{kernel_version}
7ecbca
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
7ecbca
7ecbca
Provides:         installonlypkg(kernel-module)
7ecbca
Provides:         kernel-modules = %{kernel_version}.%{_arch}
7ecbca
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
7ecbca
7ecbca
Requires(post):   /usr/sbin/depmod
7ecbca
Requires(postun): /usr/sbin/depmod
7ecbca
7ecbca
Requires(post):   /usr/bin/dracut
7ecbca
Requires(postun): /usr/bin/dracut
7ecbca
7ecbca
7ecbca
%description
7ecbca
This package provides the Broadcom MegaRAID SAS (%{pkg}) driver. Compared to
7ecbca
the in-kernel driver this driver re-enables support for deprecated adapters:
7ecbca
7ecbca
- 0x1000:0x0060: LSI MegaRAID SAS1078R
7ecbca
- 0x1000:0x0078: LSI MegaRAID SAS1078 Gen2
7ecbca
- 0x1000:0x007C: LSI MegaRAID SAS1078DE
7ecbca
- 0x1000:0x0411: LSI MegaRAID SAS1064R
7ecbca
- 0x1000:0x0413: LSI MegaRAID SAS1068 Verde ZCR
7ecbca
- 0x1028:0x0015: Dell PERC5
7ecbca
7ecbca
The removal of the following adapters has been reverted in 4.18.0-290 [1761485]:
7ecbca
- 0x1000:0x0071: LSI MegaRAID SAS0071 Skinny
7ecbca
- 0x1000:0x0073: LSI MegaRAID SAS0073 Skinny
7ecbca
- 0x1000:0x0079: LSI MegaRAID SAS0079 Gen2
7ecbca
7ecbca
7ecbca
%prep
7ecbca
%autosetup -p1 -n %{pkg}-%{driver_version}
7ecbca
7ecbca
7ecbca
%build
7ecbca
pushd src
7ecbca
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
7ecbca
popd
7ecbca
7ecbca
7ecbca
%install
7ecbca
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/scsi/megaraid src/%{pkg}.ko
7ecbca
7ecbca
# Make .ko objects temporarily executable for automatic stripping
7ecbca
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
7ecbca
7ecbca
7ecbca
%clean
7ecbca
%{__rm} -rf %{buildroot}
7ecbca
7ecbca
7ecbca
%post
7ecbca
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
7ecbca
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
7ecbca
7ecbca
7ecbca
%preun
7ecbca
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
7ecbca
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
7ecbca
7ecbca
7ecbca
%postun
7ecbca
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
7ecbca
then
7ecbca
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
7ecbca
    then
7ecbca
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
7ecbca
    fi
7ecbca
7ecbca
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
7ecbca
    then
7ecbca
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
7ecbca
        then
7ecbca
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
7ecbca
            then
7ecbca
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
7ecbca
            else
7ecbca
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
7ecbca
            fi
7ecbca
        fi
7ecbca
    fi
7ecbca
7ecbca
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
7ecbca
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
7ecbca
fi
7ecbca
7ecbca
7ecbca
%posttrans
7ecbca
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
7ecbca
then
7ecbca
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
7ecbca
    then
7ecbca
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
7ecbca
    fi
7ecbca
7ecbca
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
7ecbca
    then
7ecbca
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
7ecbca
        then
7ecbca
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
7ecbca
            then
7ecbca
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
7ecbca
            else
7ecbca
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
7ecbca
            fi
7ecbca
        fi
7ecbca
    fi
7ecbca
7ecbca
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
7ecbca
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
7ecbca
fi
7ecbca
7ecbca
7ecbca
%files
7ecbca
%defattr(644,root,root,755)
7ecbca
/lib/modules/%{kernel_version}.%{_arch}
7ecbca
%license COPYING
7ecbca
7ecbca
7ecbca
%changelog
7ecbca
* Tue Aug 31 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.14.0-1
7ecbca
- Initial version