Blame SPECS/kmod-pata_amd.spec

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