Blame SPECS/kmod-pata_atiixp.spec

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