Blame SPECS/kmod-pata_atiixp.spec

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