Blame SPECS/kmod-iwlegacy.spec

2bda55
%global pkg iwlegacy
2bda55
2bda55
%global kernel_version_min 4.18.0-315.el8
2bda55
2bda55
# To pick a specific kernel use `--define "kernel_version 4.18.0-315.el8"`
2bda55
# Otherwise the latest installed kernel-devel version later than
2bda55
# %%{kernel_version_min} will be used.
2bda55
2bda55
%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)
2bda55
2bda55
%if "%{kernel_version_latest}" != ""
2bda55
%{!?kernel_version:%{expand:%%global kernel_version %{kernel_version_latest}}}
2bda55
%endif
2bda55
2bda55
%global _use_internal_dependency_generator 0
2bda55
%global __find_requires %{nil}
2bda55
%global __find_provides /usr/lib/rpm/find-provides
2bda55
2bda55
%global debug_package %{nil}
2bda55
2bda55
%global __spec_install_post \
2bda55
  %{?__debug_package:%{__debug_install_post}} \
2bda55
  %{__arch_install_post} \
2bda55
  %{__os_install_post} \
2bda55
  %{__mod_compress_install_post}
2bda55
2bda55
%global __mod_compress_install_post find %{buildroot}/lib/modules -type f -name \*.ko -exec xz \{\} \\;
2bda55
2bda55
2bda55
Name:             kmod-%{pkg}
2bda55
Version:          5.12
d4b99e
Release:          3%{?dist}
2bda55
Summary:          Intel WiFi 3945ABG/BG (iwl3945) and 4965AGN (iwl4965) driver
2bda55
2bda55
License:          GPLv2
2bda55
URL:              https://www.kernel.org/
2bda55
2bda55
Source0:          %{pkg}-%{version}.tar.xz
2bda55
2bda55
ExclusiveArch:    x86_64
2bda55
2bda55
BuildRequires:    elfutils-libelf-devel
2bda55
BuildRequires:    gcc
2bda55
BuildRequires:    kmod
2bda55
BuildRequires:    make
2bda55
BuildRequires:    redhat-rpm-config
2bda55
BuildRequires:    xz
2bda55
2bda55
%{!?kernel_version:
2bda55
BuildRequires:    kernel-devel >= %{kernel_version_min}
2bda55
}
2bda55
2bda55
%{?kernel_version:
2bda55
BuildRequires:    kernel-devel = %{kernel_version}
2bda55
BuildRequires:    kernel-devel-uname-r = %{kernel_version}.%{_arch}
2bda55
2bda55
Requires:         kernel-core = %{kernel_version}
2bda55
Requires:         kernel-core-uname-r = %{kernel_version}.%{_arch}
2bda55
Requires:         kernel-modules = %{kernel_version}
2bda55
Requires:         kernel-modules-uname-r = %{kernel_version}.%{_arch}
2bda55
2bda55
Provides:         installonlypkg(kernel-module)
2bda55
Provides:         %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
2bda55
}
2bda55
2bda55
Requires(post):   /usr/sbin/depmod
2bda55
Requires(postun): /usr/sbin/depmod
2bda55
2bda55
Requires(post):   /usr/bin/dracut
2bda55
Requires(postun): /usr/bin/dracut
2bda55
2bda55
Provides:         kmod-iwl3945 = %{?epoch:%{epoch}:}%{version}-%{release}
2bda55
Provides:         kmod-iwl3945-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
2bda55
2bda55
Supplements:      iwl3945-firmware
2bda55
Recommends:       iwl3945-firmware
2bda55
2bda55
Provides:         kmod-iwl4965 = %{?epoch:%{epoch}:}%{version}-%{release}
2bda55
Provides:         kmod-iwl4965-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{version}-%{release}
2bda55
2bda55
Supplements:      iwl4965-firmware
2bda55
Recommends:       iwl4965-firmware
2bda55
2bda55
%description
2bda55
This package provides drivers for Intel's WiFi adapter 3945ABG/BG (iwl3945) and
2bda55
4965AGN (iwl4965) including the required Intel WiFi legacy driver (iwlegacy).
2bda55
2bda55
2bda55
%prep
2bda55
%autosetup -p1 -n %{pkg}-%{version}
2bda55
2bda55
2bda55
%build
2bda55
pushd src
2bda55
%{__make} -C /usr/src/kernels/%{kernel_version}.%{_arch} %{?_smp_mflags} M=$PWD modules
2bda55
popd
2bda55
2bda55
2bda55
%install
2bda55
%{__install} -D -t %{buildroot}/lib/modules/%{kernel_version}.%{_arch}/extra/drivers/net/wireless/intel/%{pkg} src/%{pkg}.ko src/iwl3945.ko src/iwl4965.ko
2bda55
2bda55
# Make .ko objects temporarily executable for automatic stripping
2bda55
find %{buildroot}/lib/modules -type f -name \*.ko -exec chmod u+x \{\} \+
2bda55
2bda55
2bda55
%clean
2bda55
%{__rm} -rf %{buildroot}
2bda55
2bda55
2bda55
%post
2bda55
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
2bda55
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
2bda55
2bda55
2bda55
%preun
2bda55
mkdir -p %{_localstatedir}/lib/rpm-state/sig-kmods
2bda55
touch %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
2bda55
2bda55
2bda55
%postun
2bda55
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
2bda55
then
2bda55
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
2bda55
    then
2bda55
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
2bda55
    fi
2bda55
2bda55
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
2bda55
    then
2bda55
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
2bda55
        then
2bda55
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
2bda55
            then
2bda55
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
2bda55
            else
2bda55
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
2bda55
            fi
2bda55
        fi
2bda55
    fi
2bda55
2bda55
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
2bda55
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
2bda55
fi
2bda55
2bda55
2bda55
%posttrans
2bda55
if [ -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} ]
2bda55
then
2bda55
    if [ -f /lib/modules/%{kernel_version}.%{_arch}/System.map ]
2bda55
    then
2bda55
        /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch}
2bda55
    fi
2bda55
2bda55
    if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ]
2bda55
    then
2bda55
        if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch}
2bda55
        then
2bda55
            if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
2bda55
            then
2bda55
                mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img
2bda55
            else
2bda55
                rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew
2bda55
            fi
2bda55
        fi
2bda55
    fi
2bda55
2bda55
    rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch}
2bda55
    rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods
2bda55
fi
2bda55
2bda55
2bda55
%files
2bda55
%defattr(644,root,root,755)
2bda55
/lib/modules/%{kernel_version}.%{_arch}
2bda55
%license COPYING
2bda55
2bda55
2bda55
%changelog
d4b99e
* Tue Aug 17 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.12-3
d4b99e
- Remove dracut conf file
d4b99e
a96122
* Tue Aug 17 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.12-2
a96122
- Rebuild for 4.18.0-326.el8
a96122
2bda55
* Thu Aug 12 2021 Peter Georg <peter.georg@physik.uni-regensburg.de> - 5.12-1
2bda55
- Initial version