Blame SPECS/kmod-be2net.spec

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