Blame SPECS/kmod-be2net.spec

8b0b02
%global pkg be2net
8b0b02
8b0b02
%global driver_version 5.14.0-1.el9
8b0b02
b8abdc
%global kernel_version 5.14.0-2.el9
8b0b02
8b0b02
%global _use_internal_dependency_generator 0
8b0b02
%global __find_requires %{nil}
8b0b02
%global __find_provides /usr/lib/rpm/find-provides
8b0b02
8b0b02
%global debug_package %{nil}
8b0b02
8b0b02
%global __spec_install_post \
8b0b02
  %{?__debug_package:%{__debug_install_post}} \
8b0b02
  %{__arch_install_post} \
8b0b02
  %{__os_install_post} \
8b0b02
  %{__mod_compress_install_post}
8b0b02
8b0b02
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
8b0b02
8b0b02
8b0b02
Name:             kmod-%{pkg}
8b0b02
Version:          5.14.0
b8abdc
Release:          2%{?dist}
8b0b02
Summary:          Emulex OneConnect NIC (%{pkg}) driver
8b0b02
8b0b02
License:          GPLv2
8b0b02
URL:              https://www.kernel.org/
8b0b02
8b0b02
Source0:          %{pkg}-%{driver_version}.tar.xz
8b0b02
Patch1:           0001-enable-be2-and-be3.patch
8b0b02
8b0b02
ExclusiveArch:    x86_64
8b0b02
8b0b02
BuildRequires:    elfutils-libelf-devel
8b0b02
BuildRequires:    gcc
8b0b02
BuildRequires:    kmod
8b0b02
BuildRequires:    make
8b0b02
BuildRequires:    redhat-rpm-config
8b0b02
BuildRequires:    xz
8b0b02
8b0b02
BuildRequires:    kernel-devel = %{kernel_version}
8b0b02
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
8b0b02
8b0b02
Requires:         kernel-core = %{kernel_version}
8b0b02
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
8b0b02
Requires:         kernel-modules = %{kernel_version}
8b0b02
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
8b0b02
8b0b02
Provides:         installonlypkg(kernel-module)
8b0b02
Provides:         kernel-modules = %{kernel_version}.%{_arch}
8b0b02
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
8b0b02
8b0b02
Requires(post):   /usr/sbin/depmod
8b0b02
Requires(postun): /usr/sbin/depmod
8b0b02
8b0b02
Requires(post):   /usr/bin/dracut
8b0b02
Requires(postun): /usr/bin/dracut
8b0b02
8b0b02
8b0b02
%description
8b0b02
This package provides the %{pkg} driver. Compared to the in-kernel driver this
8b0b02
driver re-enables support for deprecated BladeEngine 2 and 3 adapters.
8b0b02
8b0b02
BladeEngine 2 (BE2) devices:
8b0b02
- 0x19A2:0x0211: Emulex BladeEngine 2 Network Adapter
8b0b02
- 0x19A2:0x0700: Emulex OneConnect Tigershark NIC
8b0b02
8b0b02
BladeEngine 3 (BE3) devices:
8b0b02
- 0x19A2:0x0221: Emulex BladeEngine3 Network Adapter
8b0b02
- 0x19A2:0x0710: Emulex OneConnect Tomcat NIC
8b0b02
8b0b02
8b0b02
%prep
8b0b02
%autosetup -p1 -n %{pkg}-%{driver_version}
8b0b02
8b0b02
8b0b02
%build
8b0b02
pushd src
8b0b02
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
8b0b02
popd
8b0b02
8b0b02
8b0b02
%install
8b0b02
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/ethernet/emulex/benet src/%{pkg}.ko
8b0b02
8b0b02
# Make .ko objects temporarily executable for automatic stripping
8b0b02
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
8b0b02
8b0b02
8b0b02
%clean
8b0b02
%{__rm} -rf %{buildroot}
8b0b02
8b0b02
8b0b02
%post
8b0b02
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
8b0b02
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
8b0b02
8b0b02
8b0b02
%preun
8b0b02
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
8b0b02
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
8b0b02
8b0b02
8b0b02
%postun
8b0b02
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
8b0b02
then
8b0b02
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
8b0b02
    then
8b0b02
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
8b0b02
    fi
8b0b02
8b0b02
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
8b0b02
    then
8b0b02
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
8b0b02
        then
8b0b02
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
8b0b02
            then
8b0b02
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
8b0b02
            else
8b0b02
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
8b0b02
            fi
8b0b02
        fi
8b0b02
    fi
8b0b02
8b0b02
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
8b0b02
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
8b0b02
fi
8b0b02
8b0b02
8b0b02
%posttrans
8b0b02
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
8b0b02
then
8b0b02
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
8b0b02
    then
8b0b02
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
8b0b02
    fi
8b0b02
8b0b02
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
8b0b02
    then
8b0b02
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
8b0b02
        then
8b0b02
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
8b0b02
            then
8b0b02
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
8b0b02
            else
8b0b02
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
8b0b02
            fi
8b0b02
        fi
8b0b02
    fi
8b0b02
8b0b02
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
8b0b02
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
8b0b02
fi
8b0b02
8b0b02
8b0b02
%files
8b0b02
%defattr(644,root,root,755)
8b0b02
/lib/modules/%{kernel_version}.%{_arch}
8b0b02
%license COPYING
8b0b02
8b0b02
8b0b02
%changelog
b8abdc
* Wed Sep 15 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.14.0-2
b8abdc
- Rebuild for 5.14.0-2.el9
b8abdc
8b0b02
* Tue Aug 31 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.14.0-1
8b0b02
- Initial version