Blame SPECS/kmod-iwlegacy.spec

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